mlx.core.array_equal#

array_equal(a: scalar | array, b: scalar | array, equal_nan: bool = False, stream: None | Stream | Device = None) array#

Array equality check.

Compare two arrays for equality. Returns True if and only if the arrays have the same shape and their values are equal. The arrays need not have the same type to be considered equal.

Parameters:
  • a (array) – Input array or scalar.

  • b (array) – Input array or scalar.

  • equal_nan (bool) – If True, NaNs are considered equal. Defaults to False.

Returns:

A scalar boolean array.

Return type:

array