Class InvertPermutation<T extends TNumber>

java.lang.Object
org.tensorflow.op.RawOp
org.tensorflow.op.math.InvertPermutation<T>
All Implemented Interfaces:
Shaped, Op, Operand<T>

@Operator(group="math") public final class InvertPermutation<T extends TNumber> extends RawOp implements Operand<T>
Computes the inverse permutation of a tensor. This operation computes the inverse of an index permutation. It takes a 1-D integer tensor x, which represents the indices of a zero-based array, and swaps each value with its index position. In other words, for an output tensor y and an input tensor x, 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:

# tensor `x` is [3, 4, 0, 2, 1]
invert_permutation(x) ==> [2, 4, 3, 0, 1]
  • Field Details

  • Constructor Details

    • InvertPermutation

      public InvertPermutation(Operation operation)
  • Method Details

    • create

      @Endpoint(describeByClass=true) public static <T extends TNumber> InvertPermutation<T> create(Scope scope, Operand<T> x)
      Factory method to create a class wrapping a new InvertPermutation operation.
      Type Parameters:
      T - data type for InvertPermutation output and operands
      Parameters:
      scope - current scope
      x - 1-D.
      Returns:
      a new instance of InvertPermutation
    • y

      public Output<T> y()
      Gets y. 1-D.
      Returns:
      y.
    • asOutput

      public Output<T> asOutput()
      Description copied from interface: Operand
      Returns the symbolic handle of the tensor.

      Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

      Specified by:
      asOutput in interface Operand<T extends TNumber>
      See Also: