isclose(a: array, b: array, /, rtol: float = 1e-05, atol: float = 1e-08, *, equal_nan: bool = False, stream: None | Stream | Device = None) array#

Returns a boolean array where two arrays are element-wise equal within a tolerance.

Infinite values are considered equal if they have the same sign, NaN values are not equal unless equal_nan is True.

Two values are considered equal if:

abs(a - b) <= (atol + rtol * abs(b))

Note unlike array_equal(), this function supports numpy-style broadcasting.

  • a (array) – Input array.

  • b (array) – Input array.

  • rtol (float) – Relative tolerance.

  • atol (float) – Absolute tolerance.

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


The boolean output scalar indicating if the arrays are close.

Return type: