mindspore.ops.t

View Source On Gitee
mindspore.ops.t(input)[source]

Transposes a 2-D Tensor. 1-D Tensor are returned as it is.

Parameters

input (Tensor) – The input Tensor.

Returns

Tensor, the transpose of input .

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> from mindspore import Tensor, ops
>>> from mindspore import dtype as mstype
>>> x = Tensor([[1, 2, 3], [2, 3, 4]], mstype.float32)
>>> output = ops.t(x)
>>> print(output)
[[1. 2.]
 [2. 3.]
 [3. 4.]]