mindspore.mint.t
- mindspore.mint.t(input)[source]
Transpose the input tensor.
Warning
This is an experimental API that is subject to change or deletion.
- Parameters
input (Tensor) – The input tensor.
- Returns
Tensor, transpose 2D tensor, return 1D tensor as it is.
- Raises
ValueError – If the dimension of input is greater than 2.
ValueError – If input is empty.
TypeError – If input is not a tensor.
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, mint >>> input = Tensor(np.array([[1, 2, 3], [4, 5, 6]]), mindspore.float32) >>> output = mint.t(input) >>> print(output) [[ 1. 4.] [ 2. 5.] [ 3. 6.]]