dpnp.count_nonzero
- dpnp.count_nonzero(x1, axis=None, *, keepdims=False)[source]
Counts the number of non-zero values in the array
in_array1
.For full documentation refer to
numpy.count_nonzero
.Limitations
Parameter
x1
is supported asdpnp.ndarray
. Otherwise the function will be executed sequentially on CPU. Parameteraxis
is supported only with default value None. Parameterkeepdims
is supported only with default value False.Examples
>>> import dpnp as np >>> np.count_nonzero(np.array([1, 0, 3, 0, 5]) 3 >>> np.count_nonzero(np.array([[1, 0, 3, 0, 5],[0, 9, 0, 7, 0]])) 5