cupy.nonzero#

cupy.nonzero(a)[source]#

Return the indices of the elements that are non-zero.

Returns a tuple of arrays, one for each dimension of a, containing the indices of the non-zero elements in that dimension.

Parameters

a (cupy.ndarray) – array

Returns

Indices of elements that are non-zero.

Return type

tuple of arrays

Warning

This function may synchronize the device.

See also

numpy.nonzero()