import torch x = torch.randn(2, 3, 5) print(x) y=x.permute((2, 0, 1)) print(y)
tensor([[[ 0.8087, -0.1916, 0.5434, 1.3274, -0.2267],
[-0.3821, 0.5526, 1.2637, 0.2426, 0.2196],
[-0.0502, -0.3307, 0.4093, 1.7641, -1.4847]],
[[-0.8011, 1.1839, -1.6315, 0.0807, -1.6938],
[-0.9901, 0.7727, 0.5745, 0.7011, 0.2526],
[ 1.2984, 0.1241, -0.5864, -0.6003, -0.0889]]])
tensor([[[ 0.8087, -0.3821, -0.0502],
[-0.8011, -0.9901, 1.2984]],
[[-0.1916, 0.5526, -0.3307],
[ 1.1839, 0.7727, 0.1241]],
[[ 0.5434, 1.2637, 0.4093],
[-1.6315, 0.5745, -0.5864]],
[[ 1.3274, 0.2426, 1.7641],
[ 0.0807, 0.7011, -0.6003]],
[[-0.2267, 0.2196, -1.4847],
[-1.6938, 0.2526, -0.0889]]])