t = torch.arange(24).reshape(2, 3, 4) print(t.shape) # torch.Size([2, 3, 4]) print(t.transpose(0, 1).shape) # torch.Size([3, 2, 4]) print(t.transpose(1, 2).shape) # torch.Size([2, 4, 3])