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
x1is supported asdpnp.ndarray. Otherwise the function will be executed sequentially on CPU. Parameteraxisis supported only with default value None. Parameterkeepdimsis 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