I think that I found a “bug”.
To reproduce, try first this:
import torch
t1 = torch.zeros([3, 3, 10])
t2 = torch.tensor([[0,1,2],[3,4,5],[6,7,8]])
t1[range(t2.shape[0]), torch.tensor([range(t2.shape[1])] * t2.shape[0]).T, t2.T] = 1
Output:
tensor([[[1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
         [0., 1., 0., 0., 0., 0., 0., 0., 0., 0.],
         [0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]],

        [[0., 0., 0., 1., 0., 0., 0., 0., 0., 0.],
         [0., 0., 0., 0., 1., 0., 0., 0., 0., 0.],
         [0., 0., 0., 0., 0., 1., 0., 0., 0., 0.]],

        [[0., 0., 0., 0., 0., 0., 1., 0., 0., 0.],
         [0., 0., 0., 0., 0., 0., 0., 1., 0., 0.],
         [0., 0., 0., 0., 0., 0., 0., 0., 1., 0.]]])

This works, and now with one small modification (type of the tensor modified):
import torch
t1 = torch.zeros([3, 3, 10])
t2 = torch.tensor([[0,1,2],[3,4,5],[6,7,8]], dtype=torch.uint8)
t1[range(t2.shape[0]), torch.tensor([range(t2.shape[1])] * t2.shape[0]).T, t2.T] = 1
Output:
IndexError: too many indices for tensor of dimension 3

Do you have some explanation for this?
Best regards