oneflow.swapdims¶
-
oneflow.
swapdims
(input, dim0, dim1) → Tensor¶ This function is equivalent to torch’s swapdims function.
For example:
>>> import oneflow as flow >>> x = flow.tensor([[[0,1],[2,3]],[[4,5],[6,7]]]) >>> x tensor([[[0, 1], [2, 3]], [[4, 5], [6, 7]]], dtype=oneflow.int64) >>> flow.swapdims(x, 0, 1) tensor([[[0, 1], [4, 5]], [[2, 3], [6, 7]]], dtype=oneflow.int64) >>> flow.swapdims(x, 0, 2) tensor([[[0, 4], [2, 6]], [[1, 5], [3, 7]]], dtype=oneflow.int64)