mindspore.ops.Sub

class mindspore.ops.Sub[source]

Subtracts the second input tensor from the first input tensor element-wise.

Refer to mindspore.ops.sub() for more detail.

Supported Platforms:

Ascend GPU CPU

Examples

>>> x = Tensor(np.array([1, 2, 3]), mindspore.int32)
>>> y = Tensor(np.array([4, 5, 6]), mindspore.int32)
>>> sub = ops.Sub()
>>> output = sub(x, y)
>>> print(output)
[-3 -3 -3]