chainer.functions.permutate

chainer.functions.permutate(x, indices, axis=0, inv=False)[source]

Permutates a given variable along an axis.

This function permutate x with given indices. That means y[i] = x[indices[i]] for all i. Note that this result is same as y = x.take(indices). indices must be a permutation of [0, 1, ..., len(x) - 1].

When inv is True, indices is treated as its inverse. That means y[indices[i]] = x[i].

Parameters:
  • x (Variable) – Variable to permutate.
  • indices (Variable) – Indices to extract from the variable.
  • axis (int) – Axis that the input array is permutate along.
  • inv (bool) – If True, indices is treated as its inverse.
Returns:

Output variable.

Return type:

Variable