fn
movedim_op
→TensorImplPtrint movedim_op(const int & a, const int & source, const int & destination)Python wrappers
Public Python APIs implemented by this engine symbol.Move dimensions from source to destination positions.
Composite over permute_op. Builds an explicit permutation in
which every axis listed in source is placed at the matching index in
destination; axes not listed preserve their original relative order
and fill the remaining slots left to right. No new backward node —
gradient flows through PermuteBackward.
Math
If is the constructed permutation of , then
See Also
permute_op — underlying primitive.
Parameters
aTensorImplPtrSource tensor.
sourcevector<int>Axes of
a to move. Negative values wrap modulo a.ndim. Must be unique.destinationvector<int>Target positions for the moved axes, parallel to
source. Negative values wrap. Must be unique and have the same length as source.Returns
TensorImplPtrA view (or contiguous copy, per the primitive's policy) of a with the requested axis order.
Raises
FailureIf
a is null, the lists differ in length, or either list contains duplicates.IndexErrorIf any axis is out of range.
Examples
movedim_op(a, {0}, {-1}) moves the leading axis to the trailing
position — equivalent to a cyclic left rotation of axes.