torch.Tensor.permute
- Tensor.permute(*dims) → Tensor
Returns a view of the tensor with its dimensions permuted.
- Parameters:
dims (torch.Size) – the desired ordering of dimensions.
Returns a view of the tensor with its dimensions permuted.
dims (torch.Size) – the desired ordering of dimensions.
>>> x = torch.randn(2, 3, 5)
>>> x.size()
torch.Size([2, 3, 5])
>>> x.permute(2, 0, 1).size()
torch.Size([5, 2, 3])