- paddle. moveaxis ( x, source, destination, name=None )
Move the axis of tensor from
Other axis that have not been moved remain their original order.
x (Tensor) – The input Tensor. It is a N-D Tensor of data types bool, int32, int64, float32, float64, complex64, complex128.
source (int|tuple|list) –
sourceposition of axis that will be moved. Each element must be unique and integer.
destination (int|tuple|list(int)) –
destinationposition of axis that has been moved. Each element must be unique and integer.
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
A new tensor whose axis have been moved.
- Return type
import paddle x = paddle.ones([3, 2, 4]) paddle.moveaxis(x, [0, 1], [1, 2]).shape # [4, 3, 2] x = paddle.ones([2, 3]) paddle.moveaxis(x, 0, 1).shape # equivalent to paddle.t(x) # [3, 2]