permute
- paddle. permute ( input: Tensor, dims: Sequence[int] ) Tensor [source]
-
Permute the dimensions of a tensor.
- Parameters
-
input (Tensor) – the input tensor.
*dims (tuple|list|int) – The desired ordering of dimensions. Supports passing as variable-length arguments (e.g., permute(x, 1, 0, 2)) or as a single list/tuple (e.g., permute(x, [1, 0, 2])).
- Returns
-
A tensor with permuted dimensions.
- Return type
-
Tensor
Examples
>>> import paddle >>> x = paddle.randn([2, 3, 4]) >>> y = paddle.permute(x, (1, 0, 2)) >>> print(y.shape) [3, 2, 4] >>> y = x.permute([1, 0, 2]) >>> print(y.shape) [3, 2, 4]