megengine.functional.swapaxes¶
- swapaxes(inp, axis1, axis2)[source]¶
Interchange two axes of a tensor.
- Parameters
- Return type
- Returns
a tensor after swapping the two axes of ‘inp’.
Examples
>>> x = Tensor(np.array([[[0,1],[2,3]],[[4,5],[6,7]]], dtype=np.int32)) >>> F.swapaxes(x, 0, 2) Tensor([[[0 4] [2 6]] [[1 5] [3 7]]], dtype=int32, device=xpux:0)