InvertPermutation
tensorflow C++ API
tensorflow::ops::InvertPermutation
Computes the inverse permutation of a tensor.
Summary
This operation computes the inverse of an index permutation. It takes a 1-D integer tensorx, which represents the indices of a zero-based array, and swaps each value with its index position. In other words, for an output tensoryand an input tensorx, this operation computes the following:
y[x[i]] = i for i in [0, 1, ..., len(x) - 1]
The values must include 0. There can be no duplicate values or negative values.
For example:
```tensorx` is [3, 4, 0, 2, 1]
invert_permutation(x) ==> [2, 4, 3, 0, 1]
```
Arguments:
- scope: A Scope object
- x: A Tensor. Must be one of the following types:int32,int64. 1-D.
Returns:
- Output: A- Tensor. Has the same type as- x. 1-D.
InvertPermutation block
Source link :https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_array_ops.cpp

Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
- Input x : A 1-D Tensortype ofint32,int64(Must be one integer type).
Output:
- y : Output object of InvertPermutation class object.
Result:
- std::vector(Tensor) result_y: ATensor. invert x and y (x <--> y)
Using Method

- X에 들어있는 값과 인덱스를 서로 바꾸어서 표현한다. x = [1, 4, 3, 0, 2] --> y = [3, 0, 4, 2, 1]. 인덱스: x = [0, 1, 2, 3, 4] y = [0, 1, 2, 3, 4]