dpctl.tensor.nonzero

dpctl.tensor.nonzero(arr)[source]

Return the indices of non-zero elements.

Returns a tuple of usm_ndarrays, one for each dimension of arr, containing the indices of the non-zero elements in that dimension. The values of arr are always tested in row-major, C-style order.

Parameters:

arr (usm_ndarray) – Input array, which has non-zero array rank.

Returns:

Indices of non-zero array elements.

Return type:

Tuple[usm_ndarray, …]