tristandeleu / pytorch-meta

A collection of extensions and data-loaders for few-shot learning & meta-learning in PyTorch
https://tristandeleu.github.io/pytorch-meta/
MIT License
1.98k stars 256 forks source link

change: added seed as an argument of dataset to enable reproducibility #130

Closed janbolle closed 3 years ago

janbolle commented 3 years ago

In the init of the MetaDataset class there was the call to self.seed() but actually hadn't had an effect so far. I added a parameter and altered the call of the seed function in the __init__().

I would appreciate accepting the pull request or telling me how to set the seed otherwise, I really don't get it :sweat_smile:

tristandeleu commented 3 years ago

There is the seed method in MetaDataset that you have to call in order to seed your dataset. The call self.seed() inside the __init__ of MetaDataset is only there to initialize self.np_random. What you can do is

dataset = Sinusoid(5)
dataset.seed(0)