A Dataset exposes the data examples (__len__, __getitem__) and a DataLoader groups them into batches (mini-batches), with shuffling, parallel loading, and memory management. Batch training makes computation efficient on GPU and reduces memory consumption.
Example
DataLoader(dataset, batch_size=64, shuffle=True)