dpnp.allclose
- dpnp.allclose(a, b, rtol=1e-05, atol=1e-08, **kwargs)[source]
Returns True if two arrays are element-wise equal within a tolerance.
For full documentation refer to
numpy.allclose.- Returns:
out – A boolean 0-dim array. If its value is
True, two arrays are element-wise equal within a tolerance.- Return type:
dpnp.ndarray
Limitations
Parameters a and b are supported either as
dpnp.ndarray,dpctl.tensor.usm_ndarrayor scalars, but both a and b can not be scalars at the same time. Keyword argument kwargs is currently unsupported. Otherwise the functions will be executed sequentially on CPU. Parameters rtol and atol are supported as scalars. OtherwiseTypeErrorexception will be raised. Input array data types are limited by supported integer and floating DPNP Data types.See also
dpnp.iscloseTest whether two arrays are element-wise equal.
dpnp.allTest whether all elements evaluate to True.
dpnp.anyTest whether any element evaluates to True.
dpnp.equalReturn (x1 == x2) element-wise.
Examples
>>> import dpnp as np >>> a = np.array([1e10, 1e-7]) >>> b = np.array([1.00001e10, 1e-8]) >>> np.allclose(a, b) array([False])
>>> a = np.array([1.0, np.nan]) >>> b = np.array([1.0, np.nan]) >>> np.allclose(a, b) array([False])
>>> a = np.array([1.0, np.inf]) >>> b = np.array([1.0, np.inf]) >>> np.allclose(a, b) array([ True])