mindspore.numpy.equal(x1, x2, dtype=None)[source]

Returns the truth value of (x1 == x2) element-wise.


Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.

  • x1 (Tensor) – Input array.

  • x2 (Tensor) – Input array. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

  • 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.

Supported Platforms:

Ascend GPU CPU


>>> import mindspore.numpy as np
>>> output = np.equal(np.array([0, 1, 3]), np.arange(3))
>>> print(output)
[ True  True False]