mindspore/docs/api/api_python/ops/mindspore.ops.InvertPermuta...

22 lines
1.0 KiB
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.InvertPermutation
================================
.. py:class:: mindspore.ops.InvertPermutation
计算索引的逆置换。
该算子主要用于计算索引的逆置换。 `input_x` 是一个一维的整数Tensor一个以0开始的索引数组并将每个值与其索引位置交换。换句话说对于输出Tensor和输入 `input_x` ,依赖此计算方法 :math:`y[x[i]] = i, \quad i \in [0, 1, \ldots, \text{len}(x)-1]`
.. note::
这些值必须包括0。不能有重复的值并且值不能为负值。
输入:
- **input_x** (Union(tuple[int], list[int])) - 输入由多个整数构造,即 :math:`(y_1,y_2,...,y_S)` 代表索引。值必须包括0。不能有重复值或负值。只允许常量。最大值必须等于 `input_x` 的长度。
输出:
tuple[int]。输出的长度与 `input_x` 相同。
异常:
- **TypeError** - 如果 `input_x` 既不是tuple也不是list。
- **TypeError** - 如果 `input_x` 的元素不是int。