torch.Tensor.transpose()

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2024 Feb 28 14:26
Editor
Edited
Edited
2025 Oct 29 11:40
  • first dimension index
  • second dimension index
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