mindspore/docs/api/api_python/ops/mindspore.ops.NonZero.rst

21 lines
714 B
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.NonZero
======================
.. py:class:: mindspore.ops.NonZero
返回所有非零元素的索引位置。
输入:
- **input** (Tensor) - 输入Tensor。
- Ascend: 其秩可以等于0GE后端除外。
- CPU/GPU: 其秩应大于等于1。
输出:
二维Tensor数据类型为int64包含所有输入中的非零元素的索引位置。
如果 `input` 的维数为 `D` `input` 中的非零个数为 `N` 则输出的shape为 :math:`(N, D)`
异常:
- **TypeError** - 如果 `input` 不是Tensor。
- **RuntimeError** - 在CPU或者GPU或者Ascend的GE后端中如果 `input` 的维度为0。