mindspore.numpy.argwhere
- mindspore.numpy.argwhere(a)[source]
Find the indices of Tensor elements that are non-zero, grouped by element.
- Parameters
- Returns
Tensor. Indices of elements that are non-zero. Indices are grouped by element. This Tensor will have shape \((N, a.ndim)\) where N is the number of non-zero items.
- Raises
TypeError – If input a is not array_like.
ValueError – If dim of a equals to 0.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.numpy as np >>> x = np.array([[[1, 0], [-5, 0]]]) >>> np.argwhere(x) Tensor(shape=[2, 3], dtype=Int64, value=[[0, 0, 0], [0, 1, 0]])