Rate this Page

torch.Tensor.permute#

Tensor.permute(*dims) Tensor#

Returns a view of the tensor with its dimensions permuted.

Parameters:

dims (torch.Size, int..., tuple of int or list of int) – the desired ordering of dimensions.

Example

>>> x = torch.randn(2, 3, 5)
>>> x.size()
torch.Size([2, 3, 5])
>>> x.permute(2, 0, 1).size()
torch.Size([5, 2, 3])