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.

说明

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

参数

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

返回

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

异常

TypeError – If inputs have types not specified above.

Supported Platforms:

Ascend GPU CPU

样例

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