• Multiplies two tf.Tensors element-wise, A * B. Supports broadcasting.

    We also expose tf.mulStrict which has the same signature as this op and asserts that a and b are the same shape (does not broadcast).

    const a = tf.tensor1d([1, 2, 3, 4]);
    const b = tf.tensor1d([2, 3, 4, 5]);

    a.mul(b).print(); // or tf.mul(a, b)
    // Broadcast mul a with b.
    const a = tf.tensor1d([1, 2, 3, 4]);
    const b = tf.scalar(5);

    a.mul(b).print(); // or tf.mul(a, b)

    Type Parameters

    Parameters

    Returns T

    Doc