mindspore.numpy.array_equiv

mindspore.numpy.array_equiv(a1, a2)[源代码]

Returns True if input arrays are shape consistent and all elements equal.

Shape consistent means they are either the same shape, or one input array can be broadcasted to create the same shape as the other one.

Note

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

Parameters

a1/a2 (Union[int, float, bool, list, tuple, Tensor]) – Input arrays.

Returns

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

Raises

TypeError – If inputs have types not specified above.

Supported Platforms:

Ascend GPU CPU

Examples

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