mindspore.ops.permute

View Source On Gitee
mindspore.ops.permute(input, axis)[source]

Permute the input tensor along the specified axis.

Parameters
  • input (Tensor) – The input tensor.

  • axis (tuple(int)) – The axis in a specified order.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input_x = mindspore.tensor([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]], mindspore.float32)
>>> input_perm = (0, 2, 1)
>>> print(mindspore.ops.permute(input_x, input_perm))
[[[ 1.  4.]
  [ 2.  5.]
  [ 3.  6.]]
 [[ 7. 10.]
  [ 8. 11.]
  [ 9. 12.]]]