- torch.permute(* dims )
*dims (int…) – The desired ordering of dimensions - torch.transpose(input, dim0, dim1)
*input (Tensor) – the input tensor.
*dim0 (int) – the first dimension to be transposed
*dim1 (int) – the second dimension to be transposed
代码(permute)
x = torch.randn(2, 3, 5, 4)
print(x.size(