Skip to content
fn

permute_op

→TensorImplPtr
int permute_op(const int & a, const int & perm)

Python wrappers

Public Python APIs implemented by this engine symbol.

Permute all axes of a according to perm.

See Also

transpose_op : Full-reversal permutation. swapaxes_op : Swap two specific axes. PermuteBackward : Autograd node implementing the gradient rule.

Parameters

aTensorImplPtr
Input tensor.
permstd::vector<int>
Permutation of 0..ndim-1. Negative indices count from the end.

Returns

TensorImplPtr

Output tensor sharing storage with a but with permuted shape and stride (a view; no data copy).

Raises

ValueError
If perm is not a valid permutation of 0..ndim-1.
IndexError
If any element of perm is outside [-ndim, ndim).