latest (dev)
Copy
Latest development documentation · Updated 2026-10-15
tensorplay.functional.movedim
- tensorplay.functional.movedim(input, source, destination) Tensor[source]
Moves the dimension(s) of
inputat the position(s) insourceto the position(s) indestination.Other dimensions of
inputthat are not explicitly moved remain in their original order and appear at the positions not specified indestination.- Parameters:
Examples:
>>> t = tensorplay.randn(3,2,1) >>> t tensor([[[-0.3362], [-0.8437]], [[-0.9627], [ 0.1727]], [[ 0.5173], [-0.1398]]]) >>> tensorplay.movedim(t, 1, 0).shape tensorplay.Size([2, 3, 1]) >>> tensorplay.movedim(t, 1, 0) tensor([[[-0.3362], [-0.9627], [ 0.5173]], [[-0.8437], [ 0.1727], [-0.1398]]]) >>> tensorplay.movedim(t, (1, 2), (0, 1)).shape tensorplay.Size([2, 1, 3]) >>> tensorplay.movedim(t, (1, 2), (0, 1)) tensor([[[-0.3362, -0.9627, 0.5173]], [[-0.8437, 0.1727, -0.1398]]])
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

