• Asserts that the expression is true. Otherwise throws an error with the provided message.

    const x = 2;
    tf.util.assert(x === 2, 'x is not 2');

    Parameters

    • expr: boolean

      The expression to assert (as a boolean).

    • msg: (() => string)

      A function that returns the message to report when throwing an error. We use a function for performance reasons.

        • (): string
        • Returns string

    Returns void

    Doc

Generated using TypeDoc