mindspore.ops.movedim
- mindspore.ops.movedim(x, source, destination)[source]
Swap two dimensions of the input tensor.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> # case1 : moving single axis >>> import mindspore >>> x = mindspore.tensor(mindspore.ops.zeros((3, 4, 5))) >>> output = mindspore.ops.movedim(x, 0, -1) >>> print(output.shape) (4, 5, 3) >>> # case 2 : moving multiple axes >>> x = mindspore.tensor(mindspore.ops.zeros((3, 4, 5))) >>> output = mindspore.ops.movedim(x, (0, 2), (1, 2)) >>> print(output.shape) (4, 3, 5)