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