jax.numpy.array_equal

jax.numpy.array_equal(a1, a2, equal_nan=False)[source]

True if two arrays have the same shape and elements, False otherwise.

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

Parameters

a2 (a1,) – Input arrays.

Returns

b – Returns True if the arrays are equal.

Return type

bool

See also

allclose()

Returns True if two arrays are element-wise equal within a tolerance.

array_equiv()

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

Examples

>>> np.array_equal([1, 2], [1, 2])
True
>>> np.array_equal(np.array([1, 2]), np.array([1, 2]))
True
>>> np.array_equal([1, 2], [1, 2, 3])
False
>>> np.array_equal([1, 2], [1, 4])
False