Indexing tensor with another tensor

I want to index a tensor with another tensor, but get an empty tensor with a different shape when the tensor is uint8:

t = torch.ones(3,12,12)
i = torch.zeros(3, dtype=torch.uint8)
print(t[:, i[1], i[2]])  # tensor([], size=(3, 0, 12, 12))
print(t[i[0], i[1], i[2]])  # tensor([], size=(0, 3, 12, 12)) 
print(t[0,0,0])  # tensor(1.)

t = torch.ones(3,12,12)
i = torch.zeros(3, dtype=torch.int8)
print(t[:, i[1], i[2]]) # tensor([1., 1., 1.])
print(t[i[0], i[1], i[2]])  # tensor(1.)
print(t[0,0,0])  # tensor(1.)

My torch version is 1.7.1.

You must index with long type I think

t = torch.ones(3,12,12)
i = torch.zeros(3, dtype=torch.long)
print(t[:, i[1], i[2]])  # tensor([], size=(3, 0, 12, 12))
print(t[i[0], i[1], i[2]])  # tensor([], size=(0, 3, 12, 12)) 
print(t[0,0,0])  # tensor(1.)