mindspore.ops.argwhere

View Source On Gitee
mindspore.ops.argwhere(input)[source]

Return a tensor of containing the positions of all non-zero elements in the input tensor.

Parameters

input (Tensor) – The input tensor.

Returns

2-D Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> x = mindspore.tensor([[[1,  0], [-5, 0]]], mindspore.int32)
>>> output = mindspore.ops.argwhere(x)
>>> print(output)
[[0 0 0]
 [0 1 0]]