TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-15

tensorplay.functional.swapdims

tensorplay.functional.swapdims(input, dim0, dim1) → Tensor[source]

Alias for tensorplay.transpose().

This function is equivalent to NumPy’s swapaxes function.

Examples:

>>> x = tensorplay.tensor([[[0,1],[2,3]],[[4,5],[6,7]]])
>>> x
tensor([[[0, 1],
        [2, 3]],

        [[4, 5],
        [6, 7]]])
>>> tensorplay.swapdims(x, 0, 1)
tensor([[[0, 1],
        [4, 5]],

        [[2, 3],
        [6, 7]]])
>>> tensorplay.swapdims(x, 0, 2)
tensor([[[0, 4],
        [2, 6]],

        [[1, 5],
        [3, 7]]])

On this page

Ask DeepWiki