返回一个tensor,包含输入tensor所有非零元素的位置。
input (Tensor) - 输入tensor。
二维tensor
Ascend GPU CPU
Ascend
GPU
CPU
样例:
>>> import mindspore >>> x = mindspore.tensor([[[1, 0], [-5, 0]]], mindspore.int32) >>> output = mindspore.ops.argwhere(x) >>> print(output) [[0 0 0] [0 1 0]]