Could you recheck the value of num = train_y[0], as this dummy code snippet is running fine?
train_y = torch.tensor([[43], [0]]).cuda()
num = train_y[0]
print(num)

data = torch.randn(50)
print(data[num])
> tensor([-0.2206])
print(data[43])
> tensor(-0.2206)