oneflow.movedim¶
-
oneflow.
movedim
()¶ Moves the dimension(s) of input at the position(s) in source to the position(s) in destination. Other dimensions of input that are not explicitly moved remain in their original order and appear at the positions not specified in destination. The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.movedim.html.
- Parameters
- Returns
the output Tensor.
- Return type
For example:
>>> import oneflow as flow >>> import numpy as np >>> input = flow.tensor(np.random.randn(2, 3, 4, 5), dtype=flow.float32) >>> output = flow.movedim(input, 1, 0) >>> output.shape oneflow.Size([3, 2, 4, 5]) >>> output = flow.movedim(input, (1, 2), (0, 1)) >>> output.shape oneflow.Size([3, 4, 2, 5])