Part 10 / Topic 5 of 7
Datasets and DataLoaders
Dataset answers "give me item i"; DataLoader batches, shuffles and (optionally) parallelises loading:
loader = torch.utils.data.DataLoader(
torch.utils.data.TensorDataset(X_tr, y_tr), batch_size=64, shuffle=True)
shuffle=True for training (order must not teach the model anything), off for evaluation. Batch size trades speed against memory; 32–256 is the usual range.
Done here? The practice set for Part 10 — 4 exercises with solutions — is on the part page.