Solved by KFrank in post #2 
              
              
                Hi Wasabi! 

Use gather(): 
>>> import torch
>>> torch.__version__
'1.9.0'
>>> _ = torch.manual_seed (2021)
>>> a = 2
>>> b = 3
>>> c = 5
>>> X = torch.arange (a * b * c).reshape (a, b, c)
>>> X
tensor([[[ 0,  1,  2,  3,  4],
         [ 5,  6,  7,  8,  9],
         [10, 11, 12, 13, 14]],

        [[…