Returns a boolean scalar indicating whether all elements of two arrays are close within specified tolerances.
Usage
mlx_allclose(
a,
b,
rtol = 1e-05,
atol = 1e-08,
equal_nan = FALSE,
device = mlx_default_device()
)Arguments
- a, b
MLX arrays or objects coercible to MLX arrays
- rtol
Relative tolerance (default: 1e-5)
- atol
Absolute tolerance (default: 1e-8)
- equal_nan
If
TRUE, NaN values are considered equal (default:FALSE)- device
Execution target: supply
"gpu","cpu", or anmlx_streamcreated viamlx_new_stream(). Defaults to the currentmlx_default_device()unless noted otherwise (helpers that act on an existing array typically reuse that array's device or stream).
Details
Two values are considered close if:
abs(a - b) <= (atol + rtol * abs(b))
This function returns TRUE only if all elements are close.
Supports NumPy-style broadcasting.