mindspore.mint.t

View Source On Gitee
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
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.]]