dpnp.allclose
- dpnp.allclose(a, b, rtol=1e-05, atol=1e-08, **kwargs)[source]
Returns
Trueif two arrays are element-wise equal within a tolerance.The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(b)) and the absolute difference atol are added together to compare against the absolute difference between a and b.
If either array contains one or more
NaNs,Falseis returned.Infsare treated as equal if they are in the same place and of the same sign in both arrays.For full documentation refer to
numpy.allclose.- Returns:
out -- A 0-dim array with
Truevalue if the two arrays are equal within the given tolerance; withFalseotherwise.- 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 Available array 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])