dpnp.array_equiv

dpnp.array_equiv(a1, a2)[source]

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.

For full documentation refer to numpy.array_equiv.

Parameters:
a1{dpnp.ndarray, usm_ndarray, scalar}

First input array.

a2{dpnp.ndarray, usm_ndarray, scalar}

Second input array.

Returns:
outdpnp.ndarray of bool dtype

A 0-d array with True value if the arrays are equivalent, False otherwise.

Notes

At least one of x1 or x2 must be an array.

Examples

>>> import dpnp as np
>>> a = np.array([1, 2])
>>> b = np.array([1, 2])
>>> c = np.array([1, 3])
>>> np.array_equiv(a, b)
array(True)
>>> np.array_equiv(a, c)
array(False)

Showing the shape equivalence:

>>> b = np.array([[1, 2], [1, 2]])
>>> c = np.array([[1, 2, 1, 2], [1, 2, 1, 2]])
>>> np.array_equiv(a, b)
array(True)
>>> np.array_equiv(a, c)
array(False)
>>> b = np.array([[1, 2], [1, 3]])
>>> np.array_equiv(a, b)
array(False)