mindspore.numpy.not_equal
- mindspore.numpy.not_equal(x1, x2, dtype=None)[源代码]
Returns (x1 != x2) element-wise.
说明
Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.
- 参数
x1 (Tensor) – First input tensor to be compared.
x2 (Tensor) – Second input tensor to be compared.
dtype (
mindspore.dtype
, optional) – Defaults to None. Overrides the dtype of the output Tensor.
- 返回
Tensor or scalar, element-wise comparison of x1 and x2. Typically of type bool, unless dtype is passed. This is a scalar if both x1 and x2 are scalars.
- 异常
TypeError – If the input is not a tensor.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> import mindspore.numpy as np >>> a = np.asarray([1, 2]) >>> b = np.asarray([[1, 3],[1, 4]]) >>> print(np.not_equal(a, b)) [[False True] [False True]]