jax.numpy.array_equiv#

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

Check if two arrays are element-wise equal.

JAX implementation of numpy.array_equiv().

This function will return False if the input arrays cannot be broadcasted to the same shape.

Parameters:
  • a1 (ArrayLike) – first input array to compare.

  • a2 (ArrayLike) – second input array to compare.

Returns:

Boolean scalar array indicating whether the input arrays are element-wise equal after broadcasting.

Return type:

Array

Examples

>>> jnp.array_equiv(jnp.array([1, 2, 3]), jnp.array([1, 2, 3]))
Array(True, dtype=bool)
>>> jnp.array_equiv(jnp.array([1, 2, 3]), jnp.array([1, 2, 4]))
Array(False, dtype=bool)
>>> jnp.array_equiv(jnp.array([[1, 2, 3], [1, 2, 3]]),
...                 jnp.array([1, 2, 3]))
Array(True, dtype=bool)