← PyTorch learning path
PyTorch · Module 6 of 10

Datasets and DataLoaders

Load and batch data efficiently.

📖 Key ideas

  1. Dataset defines __len__ and __getitem__.
  2. DataLoader batches, shuffles and loads in parallel (num_workers).
  3. torchvision.datasets offers MNIST, CIFAR10 and more.
  4. Transforms preprocess and augment images.
  5. Custom datasets read your own files.
💡 Real-life example: A Dataset is a library catalogue; the DataLoader is a librarian bringing books in neat stacks.
DatasetIndexable collection of samples
DataLoaderBatches and shuffles data
num_workersParallel loading processes
TransformsPreprocessing functions