← PyTorch learning pathPyTorch · Module 6 of 10
Datasets and DataLoaders
Load and batch data efficiently.
📖 Key ideas
- Dataset defines __len__ and __getitem__.
- DataLoader batches, shuffles and loads in parallel (num_workers).
- torchvision.datasets offers MNIST, CIFAR10 and more.
- Transforms preprocess and augment images.
- 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