dpnp.any

dpnp.any(x, /, axis=None, out=None, keepdims=False, *, where=True)[source]

Test whether any array element along a given axis evaluates to True.

For full documentation refer to numpy.any.

Returns:

out -- An array with a data type of bool containing the results of the logical OR reduction.

Return type:

dpnp.ndarray

Limitations

Parameters x is supported either as dpnp.ndarray or dpctl.tensor.usm_ndarray. Parameters out and where are supported with default value. Input array data types are limited by supported DPNP Available array data types. Otherwise the function will be executed sequentially on CPU.

See also

dpnp.ndarray.any

equivalent method

dpnp.all

Test whether all elements along a given axis evaluate to True.

Notes

Not a Number (NaN), positive infinity and negative infinity evaluate to True because these are not equal to zero.

Examples

>>> import dpnp as np
>>> x = np.array([[True, False], [True, True]])
>>> np.any(x)
array(True)
>>> np.any(x, axis=0)
array([ True,  True])
>>> x2 = np.array([0, 0, 0])
>>> np.any(x2)
array(False)
>>> x3 = np.array([1.0, np.nan])
>>> np.any(x3)
array(True)