mindspore.ops.swapaxes

View Source On Gitee
mindspore.ops.swapaxes(input, axis0, axis1)[source]

Interchange two axes of a tensor.

Parameters
  • input (Tensor) – The input tensor.

  • axis0 (int) – First axis.

  • axis1 (int) – Second axis.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input = mindspore.tensor(mindspore.ops.ones(([2, 3, 4])))
>>> output = mindspore.ops.swapaxes(input, 0, 2)
>>> print(output.shape)
(4, 3, 2)