mindspore.numpy.array_equal

mindspore.numpy.array_equal(a1, a2, equal_nan=False)[source]

Returns True if input arrays have same shapes and all elements equal.

Note

In mindpsore, a bool tensor is returned instead, since in Graph mode, the value cannot be traced and computed at compile time.

Since on Ascend, nan is treated differently, currently the argument equal_nan is not supported on Ascend.

Parameters
Returns

Scalar bool tensor, value is True if inputs are equal, False otherwise.

Raises

TypeError – If inputs have types not specified above.

Supported Platforms:

GPU CPU Ascend

Examples

>>> import mindspore.numpy as np
>>> a = [0,1,2]
>>> b = [[0,1,2], [0,1,2]]
>>> print(np.array_equal(a,b))
False