mindspore.ops.NotEqual

class mindspore.ops.NotEqual[source]

Computes the non-equivalence of two tensors element-wise.

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

Supported Platforms:

Ascend GPU CPU

Examples

>>> x = Tensor(np.array([1, 2, 3]), mindspore.float32)
>>> not_equal = ops.NotEqual()
>>> output = not_equal(x, 2.0)
>>> print(output)
[ True False  True]
>>>
>>> x = Tensor(np.array([1, 2, 3]), mindspore.int32)
>>> y = Tensor(np.array([1, 2, 4]), mindspore.int32)
>>> not_equal = ops.NotEqual()
>>> output = not_equal(x, y)
>>> print(output)
[False False  True]