Solved by Brando_Miranda in post #5 
              
              
                this should work: 
import torch

batch_size = 16
y = torch.randint(low=0,high=Dout,size=(batch_size,))

docs: https://pytorch.org/docs/stable/generated/torch.randint.html#torch.randint