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. Both inputs x1 and x2 can not be scalars at the same time.

  • a2 ({dpnp.ndarray, usm_ndarray, scalar}) -- Second input array. Both inputs x1 and x2 can not be scalars at the same time.

Returns:

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

Return type:

dpnp.ndarray of bool dtype

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)