torch tensor.permute()

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2025 Oct 29 11:36
Editor
Edited
Edited
2025 Oct 29 12:36
torch.Tensor.transpose()
swaps two dimensions, while permute() is a generalized operation that allows you to specify the order of all axes
torch.Tensor.transpose()
is not just sugar syntax, but rather
torch tensor.permute()
is the sugar syntax. While transpose explicitly specifies two dimensions to swap,
Pytorch tensor.T
completely reverses the shape Size array, essentially a version of permute with reversed size. tensor.mT is specifically for 2D and only allows 2D tensors.
 
 
 
 
 
 
 
 

Recommendations