permute() and movedim() in PyTorch
Tags: pytorch, permute, movedim, function
Published: 2024-04-05 06:53:10

*[My post](https://dev.to/hyperkai/transpose-adjoint-mt-mh-view-reshape-in-pytorch-3fcp) explains [transpose()](https://pytorch.org/docs/stable/generated/torch.transpose.html), [adjoint()](https://pytorch.org/docs/stable/generated/torch.adjoint.html), [mT](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.mT), [mH](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.mH), [view()](https://pytorch.org/docs/stable/generated/torch.Tensor.view.html) and [reshape()](https://pytorch.org/docs/stable/generated/torch.reshape.html).

[permute()](https://pytorch.org/docs/stable/generated/torch.permute.html) or [movedim()](https://pytorch.org/docs/stable/generated/torch.movedim.html) can permute the dimensions of a 1D or more D tensor without losing data as shown below:

*Memos:
- `permute()` and `movedim()` can be used both from [torch](https://pytorch.org/docs/stable/torch.html) and a tensor.
- The 2nd argument of `permute()` is one or more dimensions with `torch`.
- The 1st argument of `permute()` is one or more dimensions with a tensor.
- The 2nd argument of `movedim()` is one or more dimensions. These must be unique with `torch`.
- The 1st argument of `movedim()` is one or more dimensions with a tensor. These must be unique with `torch`.
- `movedim()` and [moveaxis()](https://pytorch.org/docs/stable/generated/torch.moveaxis.html) are the same because `moveaxis()` is the alias of `movedim()`.

```python
import torch

my_tensor = torch.tensor([[[0, 1, 2], [3, 4, 5]],
                          [[6, 7, 8], [9, 10, 11]],
                          [[12, 13, 14], [15, 16, 17]],
                          [[18, 19, 20], [21, 22, 23]]])
                         # The size is [4, 2, 3].
torch.permute(my_tensor, (2, 1, 0))
my_tensor.permute(2, 1, 0)
torch.movedim(my_tensor, (0, 1), (2, 1))
my_tensor.movedim((0, 1), (2, 1))
torch.movedim(my_tensor, (0, 1), (2, -2))
my_tensor.movedim((0, 1), (2, -2))
torch.movedim(my_tensor, (0, 1), (-1, 1))
my_tensor.movedim((0, 1), (-1, 1))
torch.movedim(my_tensor, (0, 1), (-1, -2))
my_tensor.movedim((0, 1), (-1, -2))
torch.movedim(my_tensor, (0, 2), (2, 0))
my_tensor.movedim((0, 2), (2, 0))
torch.movedim(my_tensor, (0, 2), (2, -3))
my_tensor.movedim((0, 2), (2, -3))
torch.movedim(my_tensor, (0, 2), (-1, 0))
my_tensor.movedim((0, 2), (-1, 0))
torch.movedim(my_tensor, (0, 2), (-1, -3))
my_tensor.movedim((0, 2), (-1, -3))
torch.movedim(my_tensor, (0, -1), (2, 0))
my_tensor.movedim((0, -1), (2, 0))
torch.movedim(my_tensor, (0, -1), (2, -3))
my_tensor.movedim((0, -1), (2, -3))
torch.movedim(my_tensor, (0, -1), (-1, 0))
my_tensor.movedim((0, -1), (-1, 0))
torch.movedim(my_tensor, (0, -1), (-1, -3))
my_tensor.movedim((0, -1), (-1, -3))
torch.movedim(my_tensor, (0, -2), (2, 1))
my_tensor.movedim((0, -2), (2, 1))
torch.movedim(my_tensor, (0, -2), (2, -2))
my_tensor.movedim((0, -2), (2, -2))
torch.movedim(my_tensor, (0, -2), (-1, 1))
my_tensor.movedim((0, -2), (-1, 1))
torch.movedim(my_tensor, (0, -2), (-1, -2))
my_tensor.movedim((0, -2), (-1, -2))
torch.movedim(my_tensor, (1, 0), (1, 2))
my_tensor.movedim((1, 0), (1, 2))
torch.movedim(my_tensor, (1, 0), (1, -1))
my_tensor.movedim((1, 0), (1, -1))
torch.movedim(my_tensor, (1, 0), (-2, 2))
my_tensor.movedim((1, 0), (-2, 2))
torch.movedim(my_tensor, (1, 0), (-2, -1))
my_tensor.movedim((1, 0), (-2, -1))
torch.movedim(my_tensor, (1, 2), (1, 0))
my_tensor.movedim((1, 2), (1, 0))
torch.movedim(my_tensor, (1, 2), (1, -3))
my_tensor.movedim((1, 2), (1, -3))
torch.movedim(my_tensor, (1, 2), (-2, 0))
my_tensor.movedim((1, 2), (-2, 0))
torch.movedim(my_tensor, (1, 2), (-2, -3))
my_tensor.movedim((1, 2), (-2, -3))
torch.movedim(my_tensor, (1, -1), (1, 0))
my_tensor.movedim((1, -1), (1, 0))
torch.movedim(my_tensor, (1, -1), (1, -3))
my_tensor.movedim((1, -1), (1, -3))
torch.movedim(my_tensor, (1, -1), (-2, 0))
my_tensor.movedim((1, -1), (-2, 0))
torch.movedim(my_tensor, (1, -1), (-2, -3))
my_tensor.movedim((1, -1), (-2, -3))
torch.movedim(my_tensor, (1, -3), (1, 2))
my_tensor.movedim((1, -3), (1, 2))
torch.movedim(my_tensor, (1, -3), (1, -1))
my_tensor.movedim((1, -3), (1, -1))
torch.movedim(my_tensor, (1, -3), (-2, 2))
my_tensor.movedim((1, -3), (-2, 2))
torch.movedim(my_tensor, (1, -3), (-2, -1))
my_tensor.movedim((1, -3), (-2, -1))
torch.movedim(my_tensor, (2, 0), (0, 2))
my_tensor.movedim((2, 0), (0, 2))
torch.movedim(my_tensor, (2, 0), (0, -1))
my_tensor.movedim((2, 0), (0, -1))
torch.movedim(my_tensor, (2, 1), (0, 1))
my_tensor.movedim((2, 0), (0, 1))
torch.movedim(my_tensor, (2, 1), (0, -2))
my_tensor.movedim((2, 1), (0, -2))
torch.movedim(my_tensor, (2, 1), (-3, 1))
my_tensor.movedim((2, 1), (-3, 1))
torch.movedim(my_tensor, (2, 1), (-3, -2))
my_tensor.movedim((2, 1), (-3, -2))
torch.movedim(my_tensor, (2, -2), (0, 1))
my_tensor.movedim((2, -2), (0, 1))
torch.movedim(my_tensor, (2, -2), (0, -2))
my_tensor.movedim((2, -2), (0, -2))
torch.movedim(my_tensor, (2, -2), (-3, 1))
my_tensor.movedim((2, -2), (-3, 1))
torch.movedim(my_tensor, (2, -2), (-3, -2))
my_tensor.movedim((2, -2), (-3, -2))
torch.movedim(my_tensor, (2, -3), (0, 2))
my_tensor.movedim((2, -3), (0, 2))
torch.movedim(my_tensor, (2, -3), (0, -1))
my_tensor.movedim((2, -3), (0, -1))
torch.movedim(my_tensor, (2, -3), (-3, 2))
my_tensor.movedim((2, -3), (-3, 2))
torch.movedim(my_tensor, (2, -3), (-3, -1))
my_tensor.movedim((2, -3), (-3, -1))
torch.movedim(my_tensor, (-1, 0), (0, 2))
my_tensor.movedim((-1, 0), (0, 2))
torch.movedim(my_tensor, (-1, 0), (0, -1))
my_tensor.movedim((-1, 0), (0, -1))
torch.movedim(my_tensor, (-1, 0), (-3, 2))
my_tensor.movedim((-1, 0), (-3, 2))
torch.movedim(my_tensor, (-1, 0), (-3, -1))
my_tensor.movedim((-1, 0), (-3, -1))
torch.movedim(my_tensor, (-1, 1), (0, 1))
my_tensor.movedim((-1, 1), (0, 1))
torch.movedim(my_tensor, (-1, 1), (0, -2))
my_tensor.movedim((-1, 1), (0, -2))
torch.movedim(my_tensor, (-1, 1), (1, 0))
my_tensor.movedim((-1, 1), (1, 0))
torch.movedim(my_tensor, (-1, 1), (-3, 1))
my_tensor.movedim((-1, 1), (-3, 1))
torch.movedim(my_tensor, (-1, 1), (-3, -2))
my_tensor.movedim((-1, 1), (-3, -2))
torch.movedim(my_tensor, (-1, -2), (0, 1))
my_tensor.movedim((-1, -2), (0, 1))
torch.movedim(my_tensor, (-1, -2), (0, -2))
my_tensor.movedim((-1, -2), (0, -2))
torch.movedim(my_tensor, (-1, -2), (-3, 1))
my_tensor.movedim((-1, -2), (-3, 1))
torch.movedim(my_tensor, (-1, -2), (-3, -2))
my_tensor.movedim((-1, -2), (-3, -2))
torch.movedim(my_tensor, (-1, -3), (0, 2))
my_tensor.movedim((-1, -3), (0, 2))
torch.movedim(my_tensor, (-1, -3), (0, -1))
my_tensor.movedim((-1, -3), (0, -1))
torch.movedim(my_tensor, (-1, -3), (-3, 2))
my_tensor.movedim((-1, -3), (-3, 2))
torch.movedim(my_tensor, (-1, -3), (-3, -1))
my_tensor.movedim((-1, -3), (-3, -1))
torch.movedim(my_tensor, (-2, 0), (1, 2))
my_tensor.movedim((-2, 0), (1, 2))
torch.movedim(my_tensor, (-2, 0), (1, -1))
my_tensor.movedim((-2, 0), (1, -1))
torch.movedim(my_tensor, (-2, 0), (-2, 2))
my_tensor.movedim((-2, 0), (-2, 2))
torch.movedim(my_tensor, (-2, 0), (-2, -1))
my_tensor.movedim((-2, 0), (-2, -1))
torch.movedim(my_tensor, (-2, 2), (1, 0))
my_tensor.movedim((-2, 2), (1, 0))
torch.movedim(my_tensor, (-2, 2), (1, -3))
my_tensor.movedim((-2, 2), (1, -3))
torch.movedim(my_tensor, (-2, 2), (-2, 0))
my_tensor.movedim((-2, 2), (-2, 0))
torch.movedim(my_tensor, (-2, 2), (-2, -3))
my_tensor.movedim((-2, 2), (-2, -3))
torch.movedim(my_tensor, (-2, -1), (1, 0))
my_tensor.movedim((-2, -1), (1, 0))
torch.movedim(my_tensor, (-2, -1), (1, -3))
my_tensor.movedim((-2, -1), (1, -3))
torch.movedim(my_tensor, (-2, -1), (-2, 0))
my_tensor.movedim((-2, -1), (-2, 0))
torch.movedim(my_tensor, (-2, -1), (-2, -3))
my_tensor.movedim((-2, -1), (-2, -3))
torch.movedim(my_tensor, (-2, -3), (1, 2))
my_tensor.movedim((-2, -3), (1, 2))
torch.movedim(my_tensor, (-2, -3), (1, -1))
my_tensor.movedim((-2, -3), (1, -1))
torch.movedim(my_tensor, (-2, -3), (-2, 2))
my_tensor.movedim((-2, -3), (-2, 2))
torch.movedim(my_tensor, (-2, -3), (-2, -1))
my_tensor.movedim((-2, -3), (-2, -1))
torch.movedim(my_tensor, (-3, 1), (2, 1))
my_tensor.movedim((-3, 1), (2, 1))
torch.movedim(my_tensor, (-3, 1), (2, -2))
my_tensor.movedim((-3, 1), (2, -2))
torch.movedim(my_tensor, (-3, 1), (-1, 1))
my_tensor.movedim((-3, 1), (-1, 1))
torch.movedim(my_tensor, (-3, 1), (-1, -2))
my_tensor.movedim((-3, 1), (-1, -2))
torch.movedim(my_tensor, (-3, 2), (2, 0))
my_tensor.movedim((-3, 2), (2, 0))
torch.movedim(my_tensor, (-3, 2), (2, -3))
my_tensor.movedim((-3, 2), (2, -3))
torch.movedim(my_tensor, (-3, 2), (-1, 0))
my_tensor.movedim((-3, 2), (-1, 0))
torch.movedim(my_tensor, (-3, 2), (-1, -3))
my_tensor.movedim((-3, 2), (-1, -3))
torch.movedim(my_tensor, (-3, -1), (2, 0))
my_tensor.movedim((-3, -1), (2, 0))
torch.movedim(my_tensor, (-3, -1), (2, -3))
my_tensor.movedim((-3, -1), (2, -3))
torch.movedim(my_tensor, (-3, -1), (-1, 0))
my_tensor.movedim((-3, -1), (-1, 0))
torch.movedim(my_tensor, (-3, -1), (-1, -3))
my_tensor.movedim((-3, -1), (-1, -3))
torch.movedim(my_tensor, (-3, -2), (2, 1))
my_tensor.movedim((-3, -2), (2, 1))
torch.movedim(my_tensor, (-3, -2), (2, -2))
my_tensor.movedim((-3, -2), (2, -2))
torch.movedim(my_tensor, (-3, -2), (-1, 1))
my_tensor.movedim((-3, -2), (-1, 1))
torch.movedim(my_tensor, (-3, -2), (-1, -2))
my_tensor.movedim((-3, -2), (-1, -2))
torch.movedim(my_tensor, (0, 1, 2), (2, 1, 0))
my_tensor.movedim((0, 1, 2), (2, 1, 0))
etc.
# tensor([[[0, 1, 2], [3, 4, 5]],
#         [[6, 7, 8], [9, 10, 11]],
#         [[12, 13, 14], [15, 16, 17]],
#         [[18, 19, 20], [21, 22, 23]]])
# The size is [4, 2, 3].

torch.permute(my_tensor, (0, 1, 2))
my_tensor.permute(0, 1, 2)
torch.movedim(my_tensor, 0, 0)
my_tensor.movedim(0, 0)
torch.movedim(my_tensor, 1, 0)
my_tensor.movedim(1, 0)
torch.movedim(my_tensor, 1, 1)
my_tensor.movedim(1, 1)
torch.movedim(my_tensor, -1, -1)
my_tensor.movedim(-1, -1)
torch.movedim(my_tensor, 1, 2)
my_tensor.movedim(1, 2)
torch.movedim(my_tensor, 1, -2)
my_tensor.movedim(1, -2)
torch.movedim(my_tensor, -1, 2)
my_tensor.movedim(-1, 2)
torch.movedim(my_tensor, 2, 2)
my_tensor.movedim(2, 2)
torch.movedim(my_tensor, 2, -1)
my_tensor.movedim(2, -1)
torch.movedim(my_tensor, -2, 1)
my_tensor.movedim(-2, 1)
torch.movedim(my_tensor, -2, -2)
my_tensor.movedim(-2, -2)
torch.movedim(my_tensor, (0,), (0,))
my_tensor.movedim((0,), (0,))
torch.movedim(my_tensor, (0,), (-3,))
my_tensor.movedim((0,), (-3,))
torch.movedim(my_tensor, (1,), (1,))
my_tensor.movedim((1,), (1,))
torch.movedim(my_tensor, (1,), (-2,))
my_tensor.movedim((1,), (-2,))
torch.movedim(my_tensor, (2,), (2,))
my_tensor.movedim((2,), (2,))
torch.movedim(my_tensor, (2,), (-1,))
my_tensor.movedim((2,), (-1,))
torch.movedim(my_tensor, (-1,), (2,))
my_tensor.movedim((-1,), (2,))
torch.movedim(my_tensor, (-1,), (-1,))
my_tensor.movedim((-1,), (-1,))
torch.movedim(my_tensor, (-2,), (1,))
my_tensor.movedim((-2,), (1,))
torch.movedim(my_tensor, (-2,), (-2,))
my_tensor.movedim((-2,), (-2,))
torch.movedim(my_tensor, (-3,), (0,))
my_tensor.movedim((-3,), (0,))
torch.movedim(my_tensor, (-3,), (-3,))
my_tensor.movedim((-3,), (-3,))
torch.movedim(my_tensor, (0, 1), (0, 1))
my_tensor.movedim((0, 1), (0, 1))
torch.movedim(my_tensor, (0, 1), (0, -2))
my_tensor.movedim((0, 1), (0, -2))
torch.movedim(my_tensor, (0, 1), (1, -3))
my_tensor.movedim((0, 1), (0, -3))
torch.movedim(my_tensor, (0, 1), (-3, 1))
my_tensor.movedim((0, 1), (-3, 1))
torch.movedim(my_tensor, (0, 1), (-3, -2))
my_tensor.movedim((0, 1), (-3, -2))
torch.movedim(my_tensor, (0, 2), (0, 2))
my_tensor.movedim((0, 2), (0, 2))
torch.movedim(my_tensor, (0, 2), (0, -1))
my_tensor.movedim((0, 2), (0, -1))
torch.movedim(my_tensor, (0, 2), (-3, 2))
my_tensor.movedim((0, 2), (-3, 2))
torch.movedim(my_tensor, (0, 2), (-3, -1))
my_tensor.movedim((0, 2), (-3, -1))
torch.movedim(my_tensor, (0, -1), (0, 2))
my_tensor.movedim((0, -1), (0, 2))
torch.movedim(my_tensor, (0, -1), (0, -1))
my_tensor.movedim((0, -1), (0, -1))
torch.movedim(my_tensor, (0, -1), (-3, 2))
my_tensor.movedim((0, -1), (-3, 2))
torch.movedim(my_tensor, (0, -1), (-3, -1))
my_tensor.movedim((0, -1), (-3, -1))
torch.movedim(my_tensor, (0, -2), (0, 1))
my_tensor.movedim((0, -2), (0, 1))
torch.movedim(my_tensor, (0, -2), (0, -2))
my_tensor.movedim((0, -2), (0, -2))
torch.movedim(my_tensor, (0, -2), (-3, 1))
my_tensor.movedim((0, -2), (-3, 1))
torch.movedim(my_tensor, (0, -2), (-3, -2))
my_tensor.movedim((0, -2), (-3, -2))
torch.movedim(my_tensor, (1, 0), (1, 0))
my_tensor.movedim((1, 0), (1, 0))
torch.movedim(my_tensor, (1, 0), (1, -3))
my_tensor.movedim((1, 0), (1, -3))
torch.movedim(my_tensor, (1, 0), (-2, 0))
my_tensor.movedim((1, 0), (-2, 0))
torch.movedim(my_tensor, (1, 0), (-2, -3))
my_tensor.movedim((1, 0), (-2, -3))
torch.movedim(my_tensor, (1, 2), (1, 2))
my_tensor.movedim((1, 2), (1, 2))
torch.movedim(my_tensor, (1, 2), (1, -1))
my_tensor.movedim((1, 2), (1, -1))
torch.movedim(my_tensor, (1, 2), (-2, 2))
my_tensor.movedim((1, 2), (-2, 2))
torch.movedim(my_tensor, (1, 2), (-2, -1))
my_tensor.movedim((1, 2), (-2, -1))
torch.movedim(my_tensor, (1, -1), (1, 2))
my_tensor.movedim((1, -1), (1, 2))
torch.movedim(my_tensor, (1, -1), (1, -1))
my_tensor.movedim((1, -1), (1, -1))
torch.movedim(my_tensor, (1, -1), (-2, 2))
my_tensor.movedim((1, -1), (-2, 2))
torch.movedim(my_tensor, (1, -1), (-2, -1))
my_tensor.movedim((1, -1), (-2, -1))
torch.movedim(my_tensor, (1, -3), (1, 0))
my_tensor.movedim((1, -3), (1, 0))
torch.movedim(my_tensor, (1, -3), (1, -3))
my_tensor.movedim((1, -3), (1, -3))
torch.movedim(my_tensor, (1, -3), (-2, 0))
my_tensor.movedim((1, -3), (-2, 0))
torch.movedim(my_tensor, (1, -3), (-2, -3))
my_tensor.movedim((1, -3), (-2, -3))
torch.movedim(my_tensor, (2, 0), (2, 0))
my_tensor.movedim((2, 0), (2, 0))
torch.movedim(my_tensor, (2, 0), (2, -3))
my_tensor.movedim((2, 0), (2, -3))
torch.movedim(my_tensor, (2, 0), (-1, 0))
my_tensor.movedim((2, 0), (-1, 0))
torch.movedim(my_tensor, (2, 0), (-1, -3))
my_tensor.movedim((2, 0), (-1, -3))
torch.movedim(my_tensor, (2, 1), (2, 1))
my_tensor.movedim((2, 1), (2, 1))
torch.movedim(my_tensor, (2, 1), (2, -2))
my_tensor.movedim((2, 1), (2, -2))
torch.movedim(my_tensor, (2, 1), (-1, 1))
my_tensor.movedim((2, 1), (-1, 1))
torch.movedim(my_tensor, (2, 1), (-1, -2))
my_tensor.movedim((2, 1), (-1, -2))
torch.movedim(my_tensor, (2, -2), (2, 1))
my_tensor.movedim((2, -2), (2, 1))
torch.movedim(my_tensor, (2, -2), (2, -2))
my_tensor.movedim((2, -2), (2, -2))
torch.movedim(my_tensor, (2, -2), (-1, 1))
my_tensor.movedim((2, -2), (-1, 1))
torch.movedim(my_tensor, (2, -2), (-1, -2))
my_tensor.movedim((2, -2), (-1, -2))
torch.movedim(my_tensor, (2, -3), (2, 0))
my_tensor.movedim((2, -3), (2, 0))
torch.movedim(my_tensor, (2, -3), (2, -3))
my_tensor.movedim((2, -3), (2, -3))
torch.movedim(my_tensor, (2, -3), (-1, 0))
my_tensor.movedim((2, -3), (-1, 0))
torch.movedim(my_tensor, (2, -3), (-1, -3))
my_tensor.movedim((2, -3), (-1, -3))
torch.movedim(my_tensor, (-1, 0), (2, 0))
my_tensor.movedim((-1, 0), (2, 0))
torch.movedim(my_tensor, (-1, 0), (2, -3))
my_tensor.movedim((-1, 0), (2, -3))
torch.movedim(my_tensor, (-1, 0), (-1, 0))
my_tensor.movedim((-1, 0), (-1, 0))
torch.movedim(my_tensor, (-1, 0), (-1, -3))
my_tensor.movedim((-1, 0), (-1, -3))
torch.movedim(my_tensor, (-1, 1), (2, 1))
my_tensor.movedim((-1, 1), (2, 1))
torch.movedim(my_tensor, (-1, 1), (2, -2))
my_tensor.movedim((-1, 1), (2, -2))
torch.movedim(my_tensor, (-1, 1), (-1, 1))
my_tensor.movedim((-1, 1), (-1, 1))
torch.movedim(my_tensor, (-1, 1), (-1, -2))
my_tensor.movedim((-1, 1), (-1, -2))
torch.movedim(my_tensor, (-1, -2), (2, 1))
my_tensor.movedim((-1, -2), (2, 1))
torch.movedim(my_tensor, (-1, -2), (2, -2))
my_tensor.movedim((-1, -2), (2, -2))
torch.movedim(my_tensor, (-1, -2), (-1, 1))
my_tensor.movedim((-1, -2), (-1, 1))
torch.movedim(my_tensor, (-1, -2), (-1, -2))
my_tensor.movedim((-1, -2), (-1, -2))
torch.movedim(my_tensor, (-1, -3), (2, 0))
my_tensor.movedim((-1, -3), (2, 0))
torch.movedim(my_tensor, (-1, -3), (2, -3))
my_tensor.movedim((-1, -3), (2, -3))
torch.movedim(my_tensor, (-1, -3), (-1, 0))
my_tensor.movedim((-1, -3), (-1, 0))
torch.movedim(my_tensor, (-1, -3), (-1, -3))
my_tensor.movedim((-1, -3), (-1, -3))
torch.movedim(my_tensor, (-2, 0), (1, 0))
my_tensor.movedim((-2, 0), (1, 0))
torch.movedim(my_tensor, (-2, 0), (1, -3))
my_tensor.movedim((-2, 0), (1, -3))
torch.movedim(my_tensor, (-2, 0), (-2, 0))
my_tensor.movedim((-2, 0), (-2, 0))
torch.movedim(my_tensor, (-2, 0), (-2, -3))
my_tensor.movedim((-2, 0), (-2, -3))
torch.movedim(my_tensor, (-2, 2), (1, 2))
my_tensor.movedim((-2, 2), (1, 2))
torch.movedim(my_tensor, (-2, 2), (1, -1))
my_tensor.movedim((-2, 2), (1, -1))
torch.movedim(my_tensor, (-2, 2), (-2, 2))
my_tensor.movedim((-2, 2), (-2, 2))
torch.movedim(my_tensor, (-2, 2), (-2, -1))
my_tensor.movedim((-2, 2), (-2, -1))
torch.movedim(my_tensor, (-2, -1), (-2, 2))
my_tensor.movedim((-2, -1), (-2, 2))
torch.movedim(my_tensor, (-2, -1), (-2, -1))
my_tensor.movedim((-2, -1), (-2, -1))
torch.movedim(my_tensor, (-2, -3), (1, 0))
my_tensor.movedim((-2, -3), (1, 0))
torch.movedim(my_tensor, (-2, -3), (1, -3))
my_tensor.movedim((-2, -3), (1, -3))
torch.movedim(my_tensor, (-2, -3), (-2, 0))
my_tensor.movedim((-2, -3), (-2, 0))
torch.movedim(my_tensor, (-2, -3), (-2, -3))
my_tensor.movedim((-2, -3), (-2, -3))
torch.movedim(my_tensor, (-3, 1), (0, 1))
my_tensor.movedim((-3, 1), (0, 1))
torch.movedim(my_tensor, (-3, 1), (0, -2))
my_tensor.movedim((-3, 1), (0, -2))
torch.movedim(my_tensor, (-3, 1), (-3, 1))
my_tensor.movedim((-3, 1), (-3, 1))
torch.movedim(my_tensor, (-3, 1), (-3, -2))
my_tensor.movedim((-3, 1), (-3, -2))
torch.movedim(my_tensor, (-3, 2), (0, 2))
my_tensor.movedim((-3, 2), (0, 2))
torch.movedim(my_tensor, (-3, 2), (0, -1))
my_tensor.movedim((-3, 2), (0, -1))
torch.movedim(my_tensor, (-3, 2), (-3, 2))
my_tensor.movedim((-3, 2), (-3, 2))
torch.movedim(my_tensor, (-3, 2), (-3, -1))
my_tensor.movedim((-3, 2), (-3, -1))
torch.movedim(my_tensor, (-3, -1), (0, 2))
my_tensor.movedim((-3, -1), (0, 2))
torch.movedim(my_tensor, (-3, -1), (0, -1))
my_tensor.movedim((-3, -1), (0, -1))
torch.movedim(my_tensor, (-3, -1), (-3, 2))
my_tensor.movedim((-3, -1), (-3, 2))
torch.movedim(my_tensor, (-3, -1), (-3, -1))
my_tensor.movedim((-3, -1), (-3, -1))
torch.movedim(my_tensor, (-3, -2), (0, 1))
my_tensor.movedim((-3, -2), (0, 1))
torch.movedim(my_tensor, (-3, -2), (0, -2))
my_tensor.movedim((-3, -2), (0, -2))
torch.movedim(my_tensor, (-3, -2), (1, -3))
my_tensor.movedim((-3, -2), (1, -3))
torch.movedim(my_tensor, (-3, -2), (-3, 1))
my_tensor.movedim((-3, -2), (-3, 1))
torch.movedim(my_tensor, (-3, -2), (-3, -2))
my_tensor.movedim((-3, -2), (-3, -2))
torch.movedim(my_tensor, (0, 1, 2), (0, 1, 2))
my_tensor.movedim((0, 1, 2), (0, 1, 2))
etc.
# tensor([[[0, 6, 12, 18], [3, 9, 15, 21]],
#         [[1, 7, 13, 19], [4, 10, 16, 22]],
#         [[2, 8, 14, 20], [5, 11, 17, 23]]])
# The size is [3, 2, 4].

torch.permute(my_tensor, (2, 0, 1))
my_tensor.permute(2, 0, 1)
torch.movedim(my_tensor, -1, 0)
my_tensor.movedim(-1, 0)
torch.movedim(my_tensor, 2, 0)
my_tensor.movedim(2, 0)
torch.movedim(my_tensor, (2,), (0,))
my_tensor.movedim((2,), (0,))
torch.movedim(my_tensor, (2,), (-3,))
my_tensor.movedim((2,), (-3,))
torch.movedim(my_tensor, (-1,), (0,))
my_tensor.movedim((-1,), (0,))
torch.movedim(my_tensor, (-1,), (-3,))
my_tensor.movedim((-1,), (-3,))
torch.movedim(my_tensor, (0, 1), (1, 2))
my_tensor.movedim((0, 1), (1, 2))
torch.movedim(my_tensor, (0, 1), (1, -1))
my_tensor.movedim((0, 1), (1, -1))
torch.movedim(my_tensor, (0, 1), (-2, 2))
my_tensor.movedim((0, 1), (-2, 2))
torch.movedim(my_tensor, (0, 1), (-2, -1))
my_tensor.movedim((0, 1), (-2, -1))
torch.movedim(my_tensor, (0, 2), (1, 0))
my_tensor.movedim((0, 2), (1, 0))
torch.movedim(my_tensor, (0, 2), (1, -3))
my_tensor.movedim((0, 2), (1, -3))
torch.movedim(my_tensor, (0, 2), (-2, 0))
my_tensor.movedim((0, 2), (-2, 0))
torch.movedim(my_tensor, (0, 2), (-2, -3))
my_tensor.movedim((0, 2), (-2, -3))
torch.movedim(my_tensor, (0, -1), (1, 0))
my_tensor.movedim((0, -1), (1, 0))
torch.movedim(my_tensor, (0, -1), (1, -3))
my_tensor.movedim((0, -1), (1, -3))
torch.movedim(my_tensor, (0, -1), (-2, 0))
my_tensor.movedim((0, -1), (-2, 0))
torch.movedim(my_tensor, (0, -1), (-2, -3))
my_tensor.movedim((0, -1), (-2, -3))
torch.movedim(my_tensor, (0, -2), (1, 2))
my_tensor.movedim((0, -2), (1, 2))
torch.movedim(my_tensor, (0, -2), (1, -1))
my_tensor.movedim((0, -2), (1, -1))
torch.movedim(my_tensor, (0, -2), (-2, 2))
my_tensor.movedim((0, -2), (-2, 2))
torch.movedim(my_tensor, (0, -2), (-2, -1))
my_tensor.movedim((0, -2), (-2, -1))
torch.movedim(my_tensor, (1, 0), (2, 1))
my_tensor.movedim((1, 0), (2, 1))
torch.movedim(my_tensor, (1, 0), (2, -2))
my_tensor.movedim((1, 0), (2, -2))
torch.movedim(my_tensor, (1, 0), (-1, 1))
my_tensor.movedim((1, 0), (-1, 1))
torch.movedim(my_tensor, (1, 0), (-1, -2))
my_tensor.movedim((1, 0), (-1, -2))
torch.movedim(my_tensor, (1, 2), (2, 0))
my_tensor.movedim((1, 2), (2, 0))
torch.movedim(my_tensor, (1, 2), (2, -3))
my_tensor.movedim((1, 2), (2, -3))
torch.movedim(my_tensor, (1, 2), (-1, 0))
my_tensor.movedim((1, 2), (-1, 0))
torch.movedim(my_tensor, (1, 2), (-1, -3))
my_tensor.movedim((1, 2), (-1, -3))
torch.movedim(my_tensor, (1, -1), (2, 0))
my_tensor.movedim((1, -1), (2, 0))
torch.movedim(my_tensor, (1, -1), (2, -3))
my_tensor.movedim((1, -1), (2, -3))
torch.movedim(my_tensor, (1, -1), (-1, 0))
my_tensor.movedim((1, -1), (-1, 0))
torch.movedim(my_tensor, (1, -1), (-1, -3))
my_tensor.movedim((1, -1), (-1, -3))
torch.movedim(my_tensor, (1, -3), (2, 1))
my_tensor.movedim((1, -3), (2, 1))
torch.movedim(my_tensor, (1, -3), (2, -2))
my_tensor.movedim((1, -3), (2, -2))
torch.movedim(my_tensor, (1, -3), (-1, 1))
my_tensor.movedim((1, -3), (-1, 1))
torch.movedim(my_tensor, (1, -3), (-1, -2))
my_tensor.movedim((1, -3), (-1, -2))
torch.movedim(my_tensor, (2, 0), (0, 1))
my_tensor.movedim((2, 0), (0, 1))
torch.movedim(my_tensor, (2, 0), (0, -2))
my_tensor.movedim((2, 0), (0, -2))
torch.movedim(my_tensor, (2, 1), (0, 2))
my_tensor.movedim((2, 1), (0, 2))
torch.movedim(my_tensor, (2, 1), (0, -1))
my_tensor.movedim((2, 1), (0, -1))
torch.movedim(my_tensor, (2, 1), (-3, 2))
my_tensor.movedim((2, 1), (-3, 2))
torch.movedim(my_tensor, (2, 1), (-3, -1))
my_tensor.movedim((2, 1), (-3, -1))
torch.movedim(my_tensor, (2, -2), (0, 2))
my_tensor.movedim((2, -2), (0, 2))
torch.movedim(my_tensor, (2, -2), (0, -1))
my_tensor.movedim((2, -2), (0, -1))
torch.movedim(my_tensor, (2, -2), (-3, 2))
my_tensor.movedim((2, -2), (-3, 2))
torch.movedim(my_tensor, (2, -2), (-3, -1))
my_tensor.movedim((2, -2), (-3, -1))
torch.movedim(my_tensor, (2, -3), (0, 1))
my_tensor.movedim((2, -3), (0, 1))
torch.movedim(my_tensor, (2, -3), (0, -2))
my_tensor.movedim((2, -3), (0, -2))
torch.movedim(my_tensor, (2, -3), (-3, -2))
my_tensor.movedim((2, -3), (-3, -2))
torch.movedim(my_tensor, (-1, 0), (0, 1))
my_tensor.movedim((-1, 0), (0, 1))
torch.movedim(my_tensor, (-1, 0), (0, -2))
my_tensor.movedim((-1, 0), (0, -2))
torch.movedim(my_tensor, (-1, 0), (-3, 1))
my_tensor.movedim((-1, 0), (-3, 1))
torch.movedim(my_tensor, (-1, 0), (-3, -2))
my_tensor.movedim((-1, 0), (-3, -2))
torch.movedim(my_tensor, (-1, 1), (0, 2))
my_tensor.movedim((-1, 1), (0, 2))
torch.movedim(my_tensor, (-1, 1), (0, -1))
my_tensor.movedim((-1, 1), (0, -1))
torch.movedim(my_tensor, (-1, 1), (-3, 2))
my_tensor.movedim((-1, 1), (-3, 2))
torch.movedim(my_tensor, (-1, 1), (-3, -1))
my_tensor.movedim((-1, 1), (-3, -1))
torch.movedim(my_tensor, (-1, -2), (0, 2))
my_tensor.movedim((-1, -2), (0, 2))
torch.movedim(my_tensor, (-1, -2), (0, -1))
my_tensor.movedim((-1, -2), (0, -1))
torch.movedim(my_tensor, (-1, -2), (-3, 2))
my_tensor.movedim((-1, -2), (-3, 2))
torch.movedim(my_tensor, (-1, -2), (-3, -1))
my_tensor.movedim((-1, -2), (-3, -1))
torch.movedim(my_tensor, (-1, -3), (0, 1))
my_tensor.movedim((-1, -3), (0, 1))
torch.movedim(my_tensor, (-1, -3), (0, -2))
my_tensor.movedim((-1, -3), (0, -2))
torch.movedim(my_tensor, (-1, -3), (-3, 1))
my_tensor.movedim((-1, -3), (-3, 1))
torch.movedim(my_tensor, (-1, -3), (-3, -2))
my_tensor.movedim((-1, -3), (-3, -2))
torch.movedim(my_tensor, (-2, 0), (2, 1))
my_tensor.movedim((-2, 0), (2, 1))
torch.movedim(my_tensor, (-2, 0), (2, -2))
my_tensor.movedim((-2, 0), (2, -2))
torch.movedim(my_tensor, (-2, 0), (-1, 1))
my_tensor.movedim((-2, 0), (-1, 1))
torch.movedim(my_tensor, (-2, 0), (-1, -2))
my_tensor.movedim((-2, 0), (-1, -2))
torch.movedim(my_tensor, (-2, 2), (2, 0))
my_tensor.movedim((-2, 2), (2, 0))
torch.movedim(my_tensor, (-2, 2), (2, -3))
my_tensor.movedim((-2, 2), (2, -3))
torch.movedim(my_tensor, (-2, 2), (-1, 0))
my_tensor.movedim((-2, 2), (-1, 0))
torch.movedim(my_tensor, (-2, 2), (-1, -3))
my_tensor.movedim((-2, 2), (-1, -3))
torch.movedim(my_tensor, (-2, -1), (1, 2))
my_tensor.movedim((-2, -1), (1, 2))
torch.movedim(my_tensor, (-2, -1), (1, -1))
my_tensor.movedim((-2, -1), (1, -1))
torch.movedim(my_tensor, (-2, -1), (2, 0))
my_tensor.movedim((-2, -1), (2, 0))
torch.movedim(my_tensor, (-2, -1), (2, -3))
my_tensor.movedim((-2, -1), (2, -3))
torch.movedim(my_tensor, (-2, -1), (-1, 0))
my_tensor.movedim((-2, -1), (-1, 0))
torch.movedim(my_tensor, (-2, -1), (-1, -3))
my_tensor.movedim((-2, -1), (-1, -3))
torch.movedim(my_tensor, (-2, -3), (2, 1))
my_tensor.movedim((-2, -3), (2, 1))
torch.movedim(my_tensor, (-2, -3), (2, -2))
my_tensor.movedim((-2, -3), (2, -2))
torch.movedim(my_tensor, (-2, -3), (-1, 1))
my_tensor.movedim((-2, -3), (-1, 1))
torch.movedim(my_tensor, (-2, -3), (-1, -2))
my_tensor.movedim((-2, -3), (-1, -2))
torch.movedim(my_tensor, (-3, 1), (1, 2))
my_tensor.movedim((-3, 1), (1, 2))
torch.movedim(my_tensor, (-3, 1), (1, -1))
my_tensor.movedim((-3, 1), (1, -1))
torch.movedim(my_tensor, (-3, 1), (-2, 2))
my_tensor.movedim((-3, 1), (-2, 2))
torch.movedim(my_tensor, (-3, 1), (-2, -1))
my_tensor.movedim((-3, 1), (-2, -1))
torch.movedim(my_tensor, (-3, 2), (1, 0))
my_tensor.movedim((-3, 2), (1, 0))
torch.movedim(my_tensor, (-3, 2), (1, -3))
my_tensor.movedim((-3, 2), (1, -3))
torch.movedim(my_tensor, (-3, 2), (-2, 0))
my_tensor.movedim((-3, 2), (-2, 0))
torch.movedim(my_tensor, (-3, 2), (-2, -3))
my_tensor.movedim((-3, 2), (-2, -3))
torch.movedim(my_tensor, (-3, -1), (1, 0))
my_tensor.movedim((-3, -1), (1, 0))
torch.movedim(my_tensor, (-3, -1), (1, -3))
my_tensor.movedim((-3, -1), (1, -3))
torch.movedim(my_tensor, (-3, -1), (-2, 0))
my_tensor.movedim((-3, -1), (-2, 0))
torch.movedim(my_tensor, (-3, -1), (-2, -3))
my_tensor.movedim((-3, -1), (-2, -3))
torch.movedim(my_tensor, (-3, -2), (1, 2))
my_tensor.movedim((-3, -2), (1, 2))
torch.movedim(my_tensor, (-3, -2), (1, -1))
my_tensor.movedim((-3, -2), (1, -1))
torch.movedim(my_tensor, (-3, -2), (-2, -1))
my_tensor.movedim((-3, -2), (-2, -1))
torch.movedim(my_tensor, (0, 1, 2), (1, 2, 0))
my_tensor.movedim((0, 1, 2), (1, 2, 0))
etc.
# tensor([[[0, 3], [1, 4], [2, 5]],
#         [[6,  9], [7, 10], [8, 11]],
#         [[12, 15], [13, 16], [14, 17]],
#         [[18, 21], [19, 22], [20, 23]]])
# The size is [4, 3, 2].

torch.permute(my_tensor, (1, 2, 0))
my_tensor.permute(1, 2, 0)
torch.movedim(my_tensor, 0, -1)
my_tensor.movedim(0, -1)
torch.movedim(my_tensor, 0, 2)
my_tensor.movedim(0, 2)
torch.movedim(my_tensor, (0,), (2,))
my_tensor.movedim((0,), (2,))
torch.movedim(my_tensor, (0,), (-1,))
my_tensor.movedim((0,), (-1,))
torch.movedim(my_tensor, (-3,), (2,))
my_tensor.movedim((-3,), (2,))
torch.movedim(my_tensor, (-3,), (-1,))
my_tensor.movedim((-3,), (-1,))
torch.movedim(my_tensor, (0, 1), (2, 0))
my_tensor.movedim((0, 1), (2, 0))
torch.movedim(my_tensor, (0, 1), (2, -3))
my_tensor.movedim((0, 1), (2, -3))
torch.movedim(my_tensor, (0, 1), (-1, 0))
my_tensor.movedim((0, 1), (-1, 0))
torch.movedim(my_tensor, (0, 1), (-1, -3))
my_tensor.movedim((0, 1), (-1, -3))
torch.movedim(my_tensor, (0, 2), (2, 1))
my_tensor.movedim((0, 2), (2, 1))
torch.movedim(my_tensor, (0, 2), (2, -2))
my_tensor.movedim((0, 2), (2, -2))
torch.movedim(my_tensor, (0, 2), (-1, 1))
my_tensor.movedim((0, 2), (-1, 1))
torch.movedim(my_tensor, (0, 2), (-1, -2))
my_tensor.movedim((0, 2), (-1, -2))
torch.movedim(my_tensor, (0, -1), (2, 1))
my_tensor.movedim((0, -1), (2, 1))
torch.movedim(my_tensor, (0, -1), (2, -2))
my_tensor.movedim((0, -1), (2, -2))
torch.movedim(my_tensor, (0, -1), (-1, 1))
my_tensor.movedim((0, -1), (-1, 1))
torch.movedim(my_tensor, (0, -1), (-1, -2))
my_tensor.movedim((0, -1), (-1, -2))
torch.movedim(my_tensor, (0, -2), (2, 0))
my_tensor.movedim((0, -2), (2, 0))
torch.movedim(my_tensor, (0, -2), (2, -3))
my_tensor.movedim((0, -2), (2, -3))
torch.movedim(my_tensor, (0, -2), (-1, 0))
my_tensor.movedim((0, -2), (-1, 0))
torch.movedim(my_tensor, (0, -2), (-1, -3))
my_tensor.movedim((0, -2), (-1, -3))
torch.movedim(my_tensor, (1, 0), (0, 2))
my_tensor.movedim((1, 0), (0, 2))
torch.movedim(my_tensor, (1, 0), (0, -1))
my_tensor.movedim((1, 0), (0, -1))
torch.movedim(my_tensor, (1, 0), (-3, 2))
my_tensor.movedim((1, 0), (-3, 2))
torch.movedim(my_tensor, (1, 0), (-3, -1))
my_tensor.movedim((1, 0), (-3, -1))
torch.movedim(my_tensor, (1, 2), (0, 1))
my_tensor.movedim((1, 2), (0, 1))
torch.movedim(my_tensor, (1, 2), (0, -2))
my_tensor.movedim((1, 2), (0, -2))
torch.movedim(my_tensor, (1, 2), (-3, 1))
my_tensor.movedim((1, 2), (-3, 1))
torch.movedim(my_tensor, (1, 2), (-3, -2))
my_tensor.movedim((1, 2), (-3, -2))
torch.movedim(my_tensor, (1, -1), (0, 1))
my_tensor.movedim((1, -1), (0, 1))
torch.movedim(my_tensor, (1, -1), (0, -2))
my_tensor.movedim((1, -1), (0, -2))
torch.movedim(my_tensor, (1, -1), (-3, 1))
my_tensor.movedim((1, -1), (-3, 1))
torch.movedim(my_tensor, (1, -1), (-3, -2))
my_tensor.movedim((1, -1), (-3, -2))
torch.movedim(my_tensor, (1, -3), (0, 2))
my_tensor.movedim((1, -3), (0, 2))
torch.movedim(my_tensor, (1, -3), (0, -1))
my_tensor.movedim((1, -3), (0, -1))
torch.movedim(my_tensor, (1, -3), (-3, 2))
my_tensor.movedim((1, -3), (-3, 2))
torch.movedim(my_tensor, (1, -3), (-3, -1))
my_tensor.movedim((1, -3), (-3, -1))
torch.movedim(my_tensor, (2, 0), (1, 2))
my_tensor.movedim((2, 0), (1, 2))
torch.movedim(my_tensor, (2, 0), (1, -1))
my_tensor.movedim((2, 0), (1, -1))
torch.movedim(my_tensor, (2, 0), (-2, 2))
my_tensor.movedim((2, 0), (-2, 2))
torch.movedim(my_tensor, (2, 0), (-2, -1))
my_tensor.movedim((2, 0), (-2, -1))
torch.movedim(my_tensor, (2, 1), (1, 0))
my_tensor.movedim((2, 1), (1, 0))
torch.movedim(my_tensor, (2, 1), (1, -3))
my_tensor.movedim((2, 1), (1, -3))
torch.movedim(my_tensor, (2, 1), (-2, 0))
my_tensor.movedim((2, 1), (-2, 0))
torch.movedim(my_tensor, (2, 1), (-2, -3))
my_tensor.movedim((2, 1), (-2, -3))
torch.movedim(my_tensor, (2, -2), (1, 0))
my_tensor.movedim((2, -2), (1, 0))
torch.movedim(my_tensor, (2, -2), (1, -3))
my_tensor.movedim((2, -2), (1, -3))
torch.movedim(my_tensor, (2, -2), (-2, 0))
my_tensor.movedim((2, -2), (-2, 0))
torch.movedim(my_tensor, (2, -2), (-2, -3))
my_tensor.movedim((2, -2), (-2, -3))
torch.movedim(my_tensor, (2, -3), (1, 2))
my_tensor.movedim((2, -3), (1, 2))
torch.movedim(my_tensor, (2, -3), (1, -1))
my_tensor.movedim((2, -3), (1, -1))
torch.movedim(my_tensor, (2, -3), (-2, 2))
my_tensor.movedim((2, -3), (-2, 2))
torch.movedim(my_tensor, (2, -3), (-2, -1))
my_tensor.movedim((2, -3), (-2, -1))
torch.movedim(my_tensor, (-1, 0), (1, 2))
my_tensor.movedim((-1, 0), (1, 2))
torch.movedim(my_tensor, (-1, 0), (1, -1))
my_tensor.movedim((-1, 0), (1, -1))
torch.movedim(my_tensor, (-1, 0), (-2, 2))
my_tensor.movedim((-1, 0), (-2, 2))
torch.movedim(my_tensor, (-1, 0), (-2, -1))
my_tensor.movedim((-1, 0), (-2, -1))
torch.movedim(my_tensor, (-1, 1), (1, -3))
my_tensor.movedim((-1, 1), (1, -3))
torch.movedim(my_tensor, (-1, 1), (-2, 0))
my_tensor.movedim((-1, 1), (-2, 0))
torch.movedim(my_tensor, (-1, 1), (-2, -3))
my_tensor.movedim((-1, 1), (-2, -3))
torch.movedim(my_tensor, (-1, -2), (1, 0))
my_tensor.movedim((-1, -2), (1, 0))
torch.movedim(my_tensor, (-1, -2), (1, -3))
my_tensor.movedim((-1, -2), (1, -3))
torch.movedim(my_tensor, (-1, -2), (-2, 0))
my_tensor.movedim((-1, -2), (-2, 0))
torch.movedim(my_tensor, (-1, -2), (-2, -3))
my_tensor.movedim((-1, -2), (-2, -3))
torch.movedim(my_tensor, (-1, -3), (1, 2))
my_tensor.movedim((-1, -3), (1, 2))
torch.movedim(my_tensor, (-1, -3), (1, -1))
my_tensor.movedim((-1, -3), (1, -1))
torch.movedim(my_tensor, (-1, -3), (-2, 2))
my_tensor.movedim((-1, -3), (-2, 2))
torch.movedim(my_tensor, (-1, -3), (-2, -1))
my_tensor.movedim((-1, -3), (-2, -1))
torch.movedim(my_tensor, (-2, 0), (0, 2))
my_tensor.movedim((-2, 0), (0, 2))
torch.movedim(my_tensor, (-2, 0), (0, -1))
my_tensor.movedim((-2, 0), (0, -1))
torch.movedim(my_tensor, (-2, 0), (-3, 2))
my_tensor.movedim((-2, 0), (-3, 2))
torch.movedim(my_tensor, (-2, 0), (-3, -1))
my_tensor.movedim((-2, 0), (-3, -1))
torch.movedim(my_tensor, (-2, 2), (0, 1))
my_tensor.movedim((-2, 2), (0, 1))
torch.movedim(my_tensor, (-2, 2), (0, -2))
my_tensor.movedim((-2, 2), (0, -2))
torch.movedim(my_tensor, (-2, 2), (-3, 1))
my_tensor.movedim((-2, 2), (-3, 1))
torch.movedim(my_tensor, (-2, 2), (-3, -2))
my_tensor.movedim((-2, 2), (-3, -2))
torch.movedim(my_tensor, (-2, -1), (0, 1))
my_tensor.movedim((-2, -1), (0, 1))
torch.movedim(my_tensor, (-2, -1), (0, -2))
my_tensor.movedim((-2, -1), (0, -2))
torch.movedim(my_tensor, (-2, -1), (-3, 1))
my_tensor.movedim((-2, -1), (-3, 1))
torch.movedim(my_tensor, (-2, -1), (-3, -2))
my_tensor.movedim((-2, -1), (-3, -2))
torch.movedim(my_tensor, (-2, -3), (0, 2))
my_tensor.movedim((-2, -3), (0, 2))
torch.movedim(my_tensor, (-2, -3), (0, -1))
my_tensor.movedim((-2, -3), (0, -1))
torch.movedim(my_tensor, (-2, -3), (-3, 2))
my_tensor.movedim((-2, -3), (-3, 2))
torch.movedim(my_tensor, (-2, -3), (-3, -1))
my_tensor.movedim((-2, -3), (-3, -1))
torch.movedim(my_tensor, (-3, 1), (2, 0))
my_tensor.movedim((-3, 1), (2, 0))
torch.movedim(my_tensor, (-3, 1), (2, -3))
my_tensor.movedim((-3, 1), (2, -3))
torch.movedim(my_tensor, (-3, 1), (-1, 0))
my_tensor.movedim((-3, 1), (-1, 0))
torch.movedim(my_tensor, (-3, 1), (-1, -3))
my_tensor.movedim((-3, 1), (-1, -3))
torch.movedim(my_tensor, (-3, 2), (2, 1))
my_tensor.movedim((-3, 2), (2, 1))
torch.movedim(my_tensor, (-3, 2), (2, -2))
my_tensor.movedim((-3, 2), (2, -2))
torch.movedim(my_tensor, (-3, 2), (-1, 1))
my_tensor.movedim((-3, 2), (-1, 1))
torch.movedim(my_tensor, (-3, 2), (-1, -2))
my_tensor.movedim((-3, 2), (-1, -2))
torch.movedim(my_tensor, (-3, -1), (2, 1))
my_tensor.movedim((-3, -1), (2, 1))
torch.movedim(my_tensor, (-3, -1), (2, -2))
my_tensor.movedim((-3, -1), (2, -2))
torch.movedim(my_tensor, (-3, -1), (-1, 1))
my_tensor.movedim((-3, -1), (-1, 1))
torch.movedim(my_tensor, (-3, -1), (-1, -2))
my_tensor.movedim((-3, -1), (-1, -2))
torch.movedim(my_tensor, (-3, -2), (2, 0))
my_tensor.movedim((-3, -2), (2, 0))
torch.movedim(my_tensor, (-3, -2), (2, -3))
my_tensor.movedim((-3, -2), (2, -3))
torch.movedim(my_tensor, (-3, -2), (-1, 0))
my_tensor.movedim((-3, -2), (-1, 0))
torch.movedim(my_tensor, (-3, -2), (-1, -3))
my_tensor.movedim((-3, -2), (-1, -3))
torch.movedim(my_tensor, (0, 1, 2), (2, 0, 1))
my_tensor.movedim((0, 1, 2), (2, 0, 1))
etc.
# tensor([[[0, 1, 2], [6, 7, 8], [12, 13, 14], [18, 19, 20]],
#         [[3, 4, 5], [9, 10, 11], [15, 16, 17], [21, 22, 23]]])
# The size is [2, 4, 3].

torch.permute(my_tensor, (0, 2, 1))
my_tensor.permute(0, 2, 1)
torch.movedim(my_tensor, 1, 2)
my_tensor.movedim(1, 2)
torch.movedim(my_tensor, 1, -1)
my_tensor.movedim(1, -1)
torch.movedim(my_tensor, -1, 1)
my_tensor.movedim(-1, 1)
torch.movedim(my_tensor, -1, -2)
my_tensor.movedim(-1, -2)
torch.movedim(my_tensor, 2, 1)
my_tensor.movedim(2, 1)
torch.movedim(my_tensor, -2, -1)
my_tensor.movedim(-2, -1)
torch.movedim(my_tensor, 2, -2)
my_tensor.movedim(2, -2)
torch.movedim(my_tensor, -2, 2)
my_tensor.movedim(-2, 2)
torch.movedim(my_tensor, (1,), (2,))
my_tensor.movedim((1,), (2,))
torch.movedim(my_tensor, (1,), (-1,))
my_tensor.movedim((1,), (-1,))
torch.movedim(my_tensor, (2,), (1,))
my_tensor.movedim((2,), (1,))
torch.movedim(my_tensor, (2,), (-2,))
my_tensor.movedim((2,), (-2,))
torch.movedim(my_tensor, (-1,), (1,))
my_tensor.movedim((-1,), (1,))
torch.movedim(my_tensor, (-1,), (-2,))
my_tensor.movedim((-1,), (-2,))
torch.movedim(my_tensor, (-2,), (2,))
my_tensor.movedim((-2,), (2,))
torch.movedim(my_tensor, (-2,), (-1,))
my_tensor.movedim((-2,), (-1,))
torch.movedim(my_tensor, (0, 1), (0, 2))
my_tensor.movedim((0, 1), (0, 2))
torch.movedim(my_tensor, (0, 1), (0, -1))
my_tensor.movedim((0, 1), (0, -1))
torch.movedim(my_tensor, (0, 1), (-3, 2))
my_tensor.movedim((0, 1), (-3, 2))
torch.movedim(my_tensor, (0, 1), (-3, -1))
my_tensor.movedim((0, 1), (-3, -1))
torch.movedim(my_tensor, (0, 2), (0, 1))
my_tensor.movedim((0, 2), (0, 1))
torch.movedim(my_tensor, (0, 2), (0, -2))
my_tensor.movedim((0, 2), (0, -2))
torch.movedim(my_tensor, (0, 2), (-3, 1))
my_tensor.movedim((0, 2), (-3, 1))
torch.movedim(my_tensor, (0, 2), (-3, -2))
my_tensor.movedim((0, 2), (-3, -2))
torch.movedim(my_tensor, (0, -1), (0, 1))
my_tensor.movedim((0, -1), (0, 1))
torch.movedim(my_tensor, (0, -1), (0, -2))
my_tensor.movedim((0, -1), (0, -2))
torch.movedim(my_tensor, (0, -1), (-3, 1))
my_tensor.movedim((0, -1), (-3, 1))
torch.movedim(my_tensor, (0, -1), (-3, -2))
my_tensor.movedim((0, -1), (-3, -2))
torch.movedim(my_tensor, (0, -2), (0, 2))
my_tensor.movedim((0, -2), (0, 2))
torch.movedim(my_tensor, (0, -2), (0, -1))
my_tensor.movedim((0, -2), (0, -1))
torch.movedim(my_tensor, (0, -2), (-3, 2))
my_tensor.movedim((0, -2), (-3, 2))
torch.movedim(my_tensor, (0, -2), (-3, -1))
my_tensor.movedim((0, -2), (-3, -1))
torch.movedim(my_tensor, (1, 0), (2, 0))
my_tensor.movedim((1, 0), (2, 0))
torch.movedim(my_tensor, (1, 0), (2, -3))
my_tensor.movedim((1, 0), (2, -3))
torch.movedim(my_tensor, (1, 0), (-1, 0))
my_tensor.movedim((1, 0), (-1, 0))
torch.movedim(my_tensor, (1, 0), (-1, -3))
my_tensor.movedim((1, 0), (-1, -3))
torch.movedim(my_tensor, (1, 2), (2, 1))
my_tensor.movedim((1, 2), (2, 1))
torch.movedim(my_tensor, (1, 2), (2, -2))
my_tensor.movedim((1, 2), (2, -2))
torch.movedim(my_tensor, (1, 2), (-1, 1))
my_tensor.movedim((1, 2), (-1, 1))
torch.movedim(my_tensor, (1, 2), (-1, -2))
my_tensor.movedim((1, 2), (-1, -2))
torch.movedim(my_tensor, (1, -1), (2, 1))
my_tensor.movedim((1, -1), (2, 1))
torch.movedim(my_tensor, (1, -1), (2, -2))
my_tensor.movedim((1, -1), (2, -2))
torch.movedim(my_tensor, (1, -1), (-1, 1))
my_tensor.movedim((1, -1), (-1, 1))
torch.movedim(my_tensor, (1, -1), (-1, -2))
my_tensor.movedim((1, -1), (-1, -2))
torch.movedim(my_tensor, (1, -3), (2, 0))
my_tensor.movedim((1, -3), (2, 0))
torch.movedim(my_tensor, (1, -3), (2, -3))
my_tensor.movedim((1, -3), (2, -3))
torch.movedim(my_tensor, (1, -3), (-1, 0))
my_tensor.movedim((1, -3), (-1, 0))
torch.movedim(my_tensor, (1, -3), (-1, -3))
my_tensor.movedim((1, -3), (-1, -3))
torch.movedim(my_tensor, (2, 0), (1, 0))
my_tensor.movedim((2, 0), (1, 0))
torch.movedim(my_tensor, (2, 0), (1, -3))
my_tensor.movedim((2, 0), (1, -3))
torch.movedim(my_tensor, (2, 0), (-2, 0))
my_tensor.movedim((2, 0), (-2, 0))
torch.movedim(my_tensor, (2, 0), (-2, -3))
my_tensor.movedim((2, 0), (-2, -3))
torch.movedim(my_tensor, (2, 1), (1, 2))
my_tensor.movedim((2, 1), (1, 2))
torch.movedim(my_tensor, (2, 1), (1, -1))
my_tensor.movedim((2, 1), (1, -1))
torch.movedim(my_tensor, (2, 1), (-2, 2))
my_tensor.movedim((2, 1), (-2, 2))
torch.movedim(my_tensor, (2, 1), (-2, -1))
my_tensor.movedim((2, 1), (-2, -1))
torch.movedim(my_tensor, (2, -2), (1, 2))
my_tensor.movedim((2, -2), (1, 2))
torch.movedim(my_tensor, (2, -2), (1, -1))
my_tensor.movedim((2, -2), (1, -1))
torch.movedim(my_tensor, (2, -2), (-2, 2))
my_tensor.movedim((2, -2), (-2, 2))
torch.movedim(my_tensor, (2, -2), (-2, -1))
my_tensor.movedim((2, -2), (-2, -1))
torch.movedim(my_tensor, (2, -3), (1, 0))
my_tensor.movedim((2, -3), (1, 0))
torch.movedim(my_tensor, (2, -3), (1, -3))
my_tensor.movedim((2, -3), (1, -3))
torch.movedim(my_tensor, (2, -3), (-2, 0))
my_tensor.movedim((2, -3), (-2, 0))
torch.movedim(my_tensor, (2, -3), (-2, -3))
my_tensor.movedim((2, -3), (-2, -3))
torch.movedim(my_tensor, (2, -3), (-3, 1))
my_tensor.movedim((2, -3), (-3, 1))
torch.movedim(my_tensor, (-1, 0), (1, 0))
my_tensor.movedim((-1, 0), (1, 0))
torch.movedim(my_tensor, (-1, 0), (1, -3))
my_tensor.movedim((-1, 0), (1, -3))
torch.movedim(my_tensor, (-1, 0), (-2, 0))
my_tensor.movedim((-1, 0), (-2, 0))
torch.movedim(my_tensor, (-1, 0), (-2, -3))
my_tensor.movedim((-1, 0), (-2, -3))
torch.movedim(my_tensor, (-1, 1), (1, 2))
my_tensor.movedim((-1, 1), (1, 2))
torch.movedim(my_tensor, (-1, 1), (1, -1))
my_tensor.movedim((-1, 1), (1, -1))
torch.movedim(my_tensor, (-1, 1), (-2, 2))
my_tensor.movedim((-1, 1), (-2, 2))
torch.movedim(my_tensor, (-1, 1), (-2, -1))
my_tensor.movedim((-1, 1), (-2, -1))
torch.movedim(my_tensor, (-1, -2), (1, 2))
my_tensor.movedim((-1, -2), (1, 2))
torch.movedim(my_tensor, (-1, -2), (1, -1))
my_tensor.movedim((-1, -2), (1, -1))
torch.movedim(my_tensor, (-1, -2), (-2, 2))
my_tensor.movedim((-1, -2), (-2, 2))
torch.movedim(my_tensor, (-1, -2), (-2, -1))
my_tensor.movedim((-1, -2), (-2, -1))
torch.movedim(my_tensor, (-1, -3), (1, 0))
my_tensor.movedim((-1, -3), (1, 0))
torch.movedim(my_tensor, (-1, -3), (1, -3))
my_tensor.movedim((-1, -3), (1, -3))
torch.movedim(my_tensor, (-1, -3), (-2, 0))
my_tensor.movedim((-1, -3), (-2, 0))
torch.movedim(my_tensor, (-1, -3), (-2, -3))
my_tensor.movedim((-1, -3), (-2, -3))
torch.movedim(my_tensor, (-2, 0), (2, 0))
my_tensor.movedim((-2, 0), (2, 0))
torch.movedim(my_tensor, (-2, 0), (2, -3))
my_tensor.movedim((-2, 0), (2, -3))
torch.movedim(my_tensor, (-2, 0), (-1, 0))
my_tensor.movedim((-2, 0), (-1, 0))
torch.movedim(my_tensor, (-2, 0), (-1, -3))
my_tensor.movedim((-2, 0), (-1, -3))
torch.movedim(my_tensor, (-2, 2), (2, 1))
my_tensor.movedim((-2, 2), (2, 1))
torch.movedim(my_tensor, (-2, 2), (2, -2))
my_tensor.movedim((-2, 2), (2, -2))
torch.movedim(my_tensor, (-2, 2), (-1, 1))
my_tensor.movedim((-2, 2), (-1, 1))
torch.movedim(my_tensor, (-2, 2), (-1, -2))
my_tensor.movedim((-2, 2), (-1, -2))
torch.movedim(my_tensor, (-2, -1), (2, 1))
my_tensor.movedim((-2, -1), (2, 1))
torch.movedim(my_tensor, (-2, -1), (2, -2))
my_tensor.movedim((-2, -1), (2, -2))
torch.movedim(my_tensor, (-2, -1), (-1, 1))
my_tensor.movedim((-2, -1), (-1, 1))
torch.movedim(my_tensor, (-2, -1), (-1, -2))
my_tensor.movedim((-2, -1), (-1, -2))
torch.movedim(my_tensor, (-2, -3), (2, 0))
my_tensor.movedim((-2, -3), (2, 0))
torch.movedim(my_tensor, (-2, -3), (2, -3))
my_tensor.movedim((-2, -3), (2, -3))
torch.movedim(my_tensor, (-2, -3), (-1, 0))
my_tensor.movedim((-2, -3), (-1, 0))
torch.movedim(my_tensor, (-2, -3), (-1, -3))
my_tensor.movedim((-2, -3), (-1, -3))
torch.movedim(my_tensor, (-3, 1), (0, 2))
my_tensor.movedim((-3, 1), (0, 2))
torch.movedim(my_tensor, (-3, 1), (0, -1))
my_tensor.movedim((-3, 1), (0, -1))
torch.movedim(my_tensor, (-3, 1), (-3, 2))
my_tensor.movedim((-3, 1), (-3, 2))
torch.movedim(my_tensor, (-3, 1), (-3, -1))
my_tensor.movedim((-3, 1), (-3, -1))
torch.movedim(my_tensor, (-3, 2), (0, 1))
my_tensor.movedim((-3, 2), (0, 1))
torch.movedim(my_tensor, (-3, 2), (0, -2))
my_tensor.movedim((-3, 2), (0, -2))
torch.movedim(my_tensor, (-3, 2), (-3, 1))
my_tensor.movedim((-3, 2), (-3, 1))
torch.movedim(my_tensor, (-3, 2), (-3, -2))
my_tensor.movedim((-3, 2), (-3, -2))
torch.movedim(my_tensor, (-3, -1), (0, 1))
my_tensor.movedim((-3, -1), (0, 1))
torch.movedim(my_tensor, (-3, -1), (0, -2))
my_tensor.movedim((-3, -1), (0, -2))
torch.movedim(my_tensor, (-3, -1), (-3, 1))
my_tensor.movedim((-3, -1), (-3, 1))
torch.movedim(my_tensor, (-3, -1), (-3, -2))
my_tensor.movedim((-3, -1), (-3, -2))
torch.movedim(my_tensor, (-3, -2), (0, 2))
my_tensor.movedim((-3, -2), (0, 2))
torch.movedim(my_tensor, (-3, -2), (0, -1))
my_tensor.movedim((-3, -2), (0, -1))
torch.movedim(my_tensor, (-3, -2), (-2, 2))
my_tensor.movedim((-3, -2), (-2, -2))
torch.movedim(my_tensor, (-3, -2), (-3, 2))
my_tensor.movedim((-3, -2), (-3, 2))
torch.movedim(my_tensor, (-3, -2), (-3, -1))
my_tensor.movedim((-3, -2), (-3, -1))
torch.movedim(my_tensor, (0, 1, 2), (0, 2, 1))
my_tensor.movedim((0, 1, 2), (0, 2, 1))
etc.
# tensor([[[0, 3], [6, 9], [12, 15], [18, 21]],
#         [[1, 4], [7, 10], [13, 16], [19, 22]],
#         [[2, 5], [8, 11], [14, 17], [20, 23]]])
# The size is [3, 4, 2].

torch.permute(my_tensor, (1, 0, 2))
my_tensor.permute(1, 0, 2)
torch.movedim(my_tensor, 0, 1)
my_tensor.movedim(0, 1)
torch.movedim(my_tensor, 0, -2)
my_tensor.movedim(0, -2)
torch.movedim(my_tensor, -2, 0)
my_tensor.movedim(-2, 0)
torch.movedim(my_tensor, (0,), (1,))
my_tensor.movedim((0,), (1,))
torch.movedim(my_tensor, (0,), (-2,))
my_tensor.movedim((0,), (-2,))
torch.movedim(my_tensor, (1,), (0,))
my_tensor.movedim((1,), (0,))
torch.movedim(my_tensor, (1,), (-3,))
my_tensor.movedim((1,), (-3,))
torch.movedim(my_tensor, (-2,), (0,))
my_tensor.movedim((-2,), (0,))
torch.movedim(my_tensor, (-2,), (-3,))
my_tensor.movedim((-2,), (-3,))
torch.movedim(my_tensor, (-3,), (1,))
my_tensor.movedim((-3,), (1,))
torch.movedim(my_tensor, (-3,), (-2,))
my_tensor.movedim((-3,), (-2,))
torch.movedim(my_tensor, (0,), (1,))
my_tensor.movedim((0,), (1,))
torch.movedim(my_tensor, (0,), (-2,))
my_tensor.movedim((0,), (-2,))
torch.movedim(my_tensor, (1,), (0,))
my_tensor.movedim((1,), (0,))
torch.movedim(my_tensor, (1,), (-3,))
my_tensor.movedim((1,), (-3,))
torch.movedim(my_tensor, (-2,), (0,))
my_tensor.movedim((-2,), (0,))
torch.movedim(my_tensor, (-2,), (-3,))
my_tensor.movedim((-2,), (-3,))
torch.movedim(my_tensor, (-3,), (1,))
my_tensor.movedim((-3,), (1,))
torch.movedim(my_tensor, (-3,), (-2,))
my_tensor.movedim((-3,), (-2,))
torch.movedim(my_tensor, (0, 1), (1, 0))
my_tensor.movedim((0, 1), (1, 0))
torch.movedim(my_tensor, (0, 1), (-2, 0))
my_tensor.movedim((0, 1), (-2, 0))
torch.movedim(my_tensor, (0, 1), (-2, -3))
my_tensor.movedim((0, 1), (-2, -3))
torch.movedim(my_tensor, (0, 2), (1, 2))
my_tensor.movedim((0, 2), (1, 2))
torch.movedim(my_tensor, (0, 2), (1, -1))
my_tensor.movedim((0, 2), (1, -1))
torch.movedim(my_tensor, (0, 2), (-2, 2))
my_tensor.movedim((0, 2), (-2, 2))
torch.movedim(my_tensor, (0, 2), (-2, -1))
my_tensor.movedim((0, 2), (-2, -1))
torch.movedim(my_tensor, (1, 0), (0, 1))
my_tensor.movedim((1, 0), (0, 1))
torch.movedim(my_tensor, (0, -1), (1, 2))
my_tensor.movedim((0, -1), (1, 2))
torch.movedim(my_tensor, (0, -1), (1, -1))
my_tensor.movedim((0, -1), (1, -1))
torch.movedim(my_tensor, (0, -1), (-2, 2))
my_tensor.movedim((0, -1), (-2, 2))
torch.movedim(my_tensor, (0, -1), (-2, -1))
my_tensor.movedim((0, -1), (-2, -1))
torch.movedim(my_tensor, (0, -2), (1, 0))
my_tensor.movedim((0, -2), (1, 0))
torch.movedim(my_tensor, (0, -2), (1, -3))
my_tensor.movedim((0, -2), (1, -3))
torch.movedim(my_tensor, (0, -2), (-2, 0))
my_tensor.movedim((0, -2), (-2, 0))
torch.movedim(my_tensor, (0, -2), (-2, -3))
my_tensor.movedim((0, -2), (-2, -3))
torch.movedim(my_tensor, (1, 0), (0, 1))
my_tensor.movedim((1, 0), (0, 1))
torch.movedim(my_tensor, (1, 0), (0, -2))
my_tensor.movedim((1, 0), (0, -2))
torch.movedim(my_tensor, (1, 0), (-3, 1))
my_tensor.movedim((1, 0), (-3, 1))
torch.movedim(my_tensor, (1, 0), (-3, -2))
my_tensor.movedim((1, 0), (-3, -2))
torch.movedim(my_tensor, (1, 2), (0, 2))
my_tensor.movedim((1, 2), (0, 2))
torch.movedim(my_tensor, (1, 2), (0, -1))
my_tensor.movedim((1, 2), (0, -1))
torch.movedim(my_tensor, (1, 2), (-3, 2))
my_tensor.movedim((1, 2), (-3, -2))
torch.movedim(my_tensor, (1, 2), (-3, -1))
my_tensor.movedim((1, 2), (-3, -1))
torch.movedim(my_tensor, (1, -1), (0, 2))
my_tensor.movedim((1, -1), (0, 2))
torch.movedim(my_tensor, (1, -1), (0, -1))
my_tensor.movedim((1, -1), (0, -1))
torch.movedim(my_tensor, (1, -1), (-3, 2))
my_tensor.movedim((1, -1), (-3, 2))
torch.movedim(my_tensor, (1, -1), (-3, -1))
my_tensor.movedim((1, -1), (-3, -1))
torch.movedim(my_tensor, (1, -3), (0, 1))
my_tensor.movedim((1, -3), (0, 1))
torch.movedim(my_tensor, (1, -3), (0, -2))
my_tensor.movedim((1, -3), (0, -2))
torch.movedim(my_tensor, (1, -3), (-3, 1))
my_tensor.movedim((1, -3), (-3, 1))
torch.movedim(my_tensor, (1, -3), (-3, -2))
my_tensor.movedim((1, -3), (-3, -2))
torch.movedim(my_tensor, (2, 0), (2, 1))
my_tensor.movedim((2, 0), (2, 1))
torch.movedim(my_tensor, (2, 0), (2, -2))
my_tensor.movedim((2, 0), (2, -2))
torch.movedim(my_tensor, (2, 0), (-1, 1))
my_tensor.movedim((2, 0), (-1, 1))
torch.movedim(my_tensor, (2, 0), (-1, -2))
my_tensor.movedim((2, 0), (-1, -2))
torch.movedim(my_tensor, (2, 1), (2, 0))
my_tensor.movedim((2, 1), (2, 0))
torch.movedim(my_tensor, (2, 1), (2, -3))
my_tensor.movedim((2, 1), (2, -3))
torch.movedim(my_tensor, (2, 1), (-1, 0))
my_tensor.movedim((2, 1), (-1, 0))
torch.movedim(my_tensor, (2, 1), (-1, -3))
my_tensor.movedim((2, 1), (-1, -3))
torch.movedim(my_tensor, (2, -2), (2, 0))
my_tensor.movedim((2, -2), (2, 0))
torch.movedim(my_tensor, (2, -2), (2, -3))
my_tensor.movedim((2, -2), (2, -3))
torch.movedim(my_tensor, (2, -2), (-1, 0))
my_tensor.movedim((2, -2), (-1, 0))
torch.movedim(my_tensor, (2, -2), (-1, -3))
my_tensor.movedim((2, -2), (-1, -3))
torch.movedim(my_tensor, (2, -3), (2, 1))
my_tensor.movedim((2, -3), (2, 1))
torch.movedim(my_tensor, (2, -3), (2, -2))
my_tensor.movedim((2, -3), (2, -2))
torch.movedim(my_tensor, (2, -3), (-1, 1))
my_tensor.movedim((2, -3), (-1, 1))
torch.movedim(my_tensor, (2, -3), (-1, -2))
my_tensor.movedim((2, -3), (-1, -2))
torch.movedim(my_tensor, (-1, 0), (2, 1))
my_tensor.movedim((-1, 0), (2, 1))
torch.movedim(my_tensor, (-1, 0), (2, -2))
my_tensor.movedim((-1, 0), (2, -2))
torch.movedim(my_tensor, (-1, 0), (-1, 1))
my_tensor.movedim((-1, 0), (-1, 1))
torch.movedim(my_tensor, (-1, 0), (-1, -2))
my_tensor.movedim((-1, 0), (-1, -2))
torch.movedim(my_tensor, (-1, 1), (2, 0))
my_tensor.movedim((-1, 1), (2, 0))
torch.movedim(my_tensor, (-1, 1), (2, -3))
my_tensor.movedim((-1, 1), (2, -3))
torch.movedim(my_tensor, (-1, 1), (-1, 0))
my_tensor.movedim((-1, 1), (-1, 0))
torch.movedim(my_tensor, (-1, 1), (-1, -3))
my_tensor.movedim((-1, 1), (-1, -3))
torch.movedim(my_tensor, (-1, -2), (2, 0))
my_tensor.movedim((-1, -2), (2, 0))
torch.movedim(my_tensor, (-1, -2), (2, -3))
my_tensor.movedim((-1, -2), (2, -3))
torch.movedim(my_tensor, (-1, -2), (-1, 0))
my_tensor.movedim((-1, -2), (-1, 0))
torch.movedim(my_tensor, (-1, -2), (-1, -3))
my_tensor.movedim((-1, -2), (-1, -3))
torch.movedim(my_tensor, (-1, -3), (2, 1))
my_tensor.movedim((-1, -3), (2, 1))
torch.movedim(my_tensor, (-1, -3), (2, -2))
my_tensor.movedim((-1, -3), (2, -2))
torch.movedim(my_tensor, (-1, -3), (-1, 1))
my_tensor.movedim((-1, -3), (-1, 1))
torch.movedim(my_tensor, (-1, -3), (-1, -2))
my_tensor.movedim((-1, -3), (-1, -2))
torch.movedim(my_tensor, (-2, 0), (0, 1))
my_tensor.movedim((-2, 0), (0, 1))
torch.movedim(my_tensor, (-2, 0), (0, -2))
my_tensor.movedim((-2, 0), (0, -2))
torch.movedim(my_tensor, (-2, 0), (-3, 1))
my_tensor.movedim((-2, 0), (-3, 1))
torch.movedim(my_tensor, (-2, 0), (-3, -2))
my_tensor.movedim((-2, 0), (-3, -2))
torch.movedim(my_tensor, (-2, 2), (0, 2))
my_tensor.movedim((-2, 2), (0, 2))
torch.movedim(my_tensor, (-2, 2), (0, -1))
my_tensor.movedim((-2, 2), (0, -1))
torch.movedim(my_tensor, (-2, 2), (-3, 2))
my_tensor.movedim((-2, 2), (-3, 2))
torch.movedim(my_tensor, (-2, 2), (-3, -1))
my_tensor.movedim((-2, 2), (-3, -1))
torch.movedim(my_tensor, (-2, -1), (0, 2))
my_tensor.movedim((-2, -1), (0, 2))
torch.movedim(my_tensor, (-2, -1), (0, -1))
my_tensor.movedim((-2, -1), (0, -1))
torch.movedim(my_tensor, (-2, -1), (-3, 2))
my_tensor.movedim((-2, -1), (-3, 2))
torch.movedim(my_tensor, (-2, -1), (-3, -1))
my_tensor.movedim((-2, -1), (-3, -1))
torch.movedim(my_tensor, (-2, -3), (0, 1))
my_tensor.movedim((-2, -3), (0, 1))
torch.movedim(my_tensor, (-2, -3), (0, -2))
my_tensor.movedim((-2, -3), (0, -2))
torch.movedim(my_tensor, (-2, -3), (-3, 1))
my_tensor.movedim((-2, -3), (-3, 1))
torch.movedim(my_tensor, (-2, -3), (-3, -2))
my_tensor.movedim((-2, -3), (-3, -2))
torch.movedim(my_tensor, (-3, 1), (1, 0))
my_tensor.movedim((-3, 1), (1, 0))
torch.movedim(my_tensor, (-3, 1), (1, -3))
my_tensor.movedim((-3, 1), (1, -3))
torch.movedim(my_tensor, (-3, 1), (-2, 0))
my_tensor.movedim((-3, 1), (-2, 0))
torch.movedim(my_tensor, (-3, 1), (-2, -3))
my_tensor.movedim((-3, 1), (-2, -3))
torch.movedim(my_tensor, (-3, 2), (1, 2))
my_tensor.movedim((-3, 2), (1, 2))
torch.movedim(my_tensor, (-3, 2), (1, -1))
my_tensor.movedim((-3, 2), (1, -1))
torch.movedim(my_tensor, (-3, 2), (-2, 2))
my_tensor.movedim((-3, 2), (-2, 2))
torch.movedim(my_tensor, (-3, 2), (-2, -1))
my_tensor.movedim((-3, 2), (-2, -1))
torch.movedim(my_tensor, (-3, -1), (1, 2))
my_tensor.movedim((-3, -1), (1, 2))
torch.movedim(my_tensor, (-3, -1), (1, -1))
my_tensor.movedim((-3, -1), (1, -1))
torch.movedim(my_tensor, (-3, -1), (-2, 2))
my_tensor.movedim((-3, -1), (-2, 2))
torch.movedim(my_tensor, (-3, -1), (-2, -1))
my_tensor.movedim((-3, -1), (-2, -1))
torch.movedim(my_tensor, (-3, -2), (1, 0))
my_tensor.movedim((-3, -2), (1, 0))
torch.movedim(my_tensor, (-3, -2), (-2, 0))
my_tensor.movedim((-3, -2), (-2, 0))
torch.movedim(my_tensor, (-3, -2), (-2, -3))
my_tensor.movedim((-3, -2), (-2, -3))
torch.movedim(my_tensor, (0, 1, 2), (1, 0, 2))
my_tensor.movedim((0, 1, 2), (1, 0, 2))
etc.
# tensor([[[0, 6, 12, 18], [1, 7, 13, 19], [2, 8, 14, 20]],
#         [[3, 9, 15, 21], [4, 10, 16, 22], [5, 11, 17, 23]]])
# The size is [2, 3, 4].
```