mindspore.mint.transpose
- mindspore.mint.transpose(input, dim0, dim1)[source]
Interchange two axes of a tensor.
Warning
This is an experimental API that is subject to change or deletion.
- Parameters
- Returns
Transposed tensor, has the same data type as input.
- Raises
TypeError – If argument input is not Tensor.
TypeError – If dim0 or dim1 is not integer.
ValueError – If dim0 or dim1 is not in the range of \([-ndim, ndim-1]\).
- Supported Platforms:
Ascend
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.transpose(input, 0, 2) >>> print(output.shape) (4, 3, 2)