mindspore.ops.NotEqual

class mindspore.ops.NotEqual[源代码]

逐元素计算两个Tensor是否不相等。

更多参考详见 mindspore.ops.ne()

支持平台:

Ascend GPU CPU

样例:

>>> 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]