Swap axes in pytorch?
Is there equivalent operation in pytorch?
Response777
apaszke
Thanks, I have just checked the Docs, but it seems that I just miss it…
Response777
<SCODE>a = torch.rand(1,2,3,4)
print(a.transpose(0,3).transpose(1,2).size())
print(a.permute(3,2,1,0).size())
<ECODE>
fmassa
Indeed, it can be a shortcut to use <SCODE>tensor.transpose_(0, 1)
<ECODE> instead of <SCODE>tensor = tensor.transpose(0, 1)
<ECODE>
fmassa
rahulbhalley