jax.numpy.array_equiv

jax.numpy.array_equiv(a1, a2)[source]

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

LAX-backend implementation of array_equiv(). Original docstring below.

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.

Parameters

a2 (a1,) – Input arrays.

Returns

out – True if equivalent, False otherwise.

Return type

bool

Examples

>>> np.array_equiv([1, 2], [1, 2])
True
>>> np.array_equiv([1, 2], [1, 3])
False

Showing the shape equivalence:

>>> np.array_equiv([1, 2], [[1, 2], [1, 2]])
True
>>> np.array_equiv([1, 2], [[1, 2, 1, 2], [1, 2, 1, 2]])
False
>>> np.array_equiv([1, 2], [[1, 2], [1, 3]])
False