victoresque / pytorch-template

PyTorch deep learning projects made easy.
MIT License
4.7k stars 1.08k forks source link

Dataloader & Shuffle #41

Closed sajaddarabi closed 5 years ago

sajaddarabi commented 5 years ago

When setting 'validation_split > 0.0 the base_data_loader creates samplers that shuffle the indices of the dataset.

Shouldn't these be wrapped with an if statement? i.e. shuffle the indices when self.shuffle is set to True

SunQpark commented 5 years ago

Even if the indices are not shuffled in base_data_loader.py at line 35~36, data loader will still yield shuffled batches since SubsetRandomSampler shuffles indices anyway. That shuffling of indices in base_data_loader is for splitting train/validation set randomly, while shuffle option in config(which is assigned to self.shuffle) is for fixing order batches.