samedi 13 mars 2021

Generating random context points for batch size

if I have N (input, output) pairs, and I want to create a random subset of these points to then train on a model of say, batch size 3, how can I encode this to then implemenent it in my data.DataLoader ?

I currently have:

dataset = data.TensorDataset(x, y)
ran = random.randint(1,40) 
batch_size = 3
data_iter =  data.DataLoader(dataset, batch_size, shuffle=True)

I'm assuming I need to apply ran to dataset but I am struggling to do this. Thanks!




Aucun commentaire:

Enregistrer un commentaire