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

    const a = tf.tensor1d([10, 20, 30, 40]);
    const b = tf.tensor1d([1, 2, 3, 4]);

    a.sub(b).print(); // or tf.sub(a, b)
    // Broadcast subtract a with b.
    const a = tf.tensor1d([10, 20, 30, 40]);
    const b = tf.scalar(5);

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

    Type Parameters

    Parameters

    Returns T