DataLoaders - wrapping an iterable over the Dataset means?

Viewed 200

I am reading the official documentation of Dataloaders:

https://pytorch.org/tutorials/beginner/basics/data_tutorial.html

And there is this sentence "DataLoader wraps an iterable around the Dataset.."

I know that dataloaders are used to iterate over the dataset but what I don't get is that what does wrapping an iterable over the dataset means? I want an insight of the theoretical point of view.

1 Answers

The sentence means that a DataLoader can be used to iterate the contents of a Dataset. For example, if you've got a Dataset of 1000 images, you can iterate certain attributes in the order that they've been stored in the Dataset and nothing else by itself. In the other hand, a DataLoader that wraps that Dataset allows you to iterate the data in batches, shuffle the data, apply functions, sample data, etc. Just checkout the Pytorch docs on torch.utils.data.DataLoader and you'll see all of the options included.

Related