mindspore.mint.swapaxes

View Source On Gitee
mindspore.mint.swapaxes(input, axis0, axis1)[source]

Interchange two axes of a tensor, alias for mint.transpose()

Examples

>>> import numpy as np
>>> from mindspore import mint
>>> from mindspore import Tensor
>>> input = Tensor(np.ones((2,3,4), dtype=np.float32))
>>> output = mint.swapaxes(input, 0, 2)
>>> print(output.shape)
(4, 3, 2)