0PricingLogin
Deep Learning Academy · Lesson

Write a Custom Dataset Class

Implement __len__ and __getitem__.

Your Data Needs a Front Door

Before a model can learn, PyTorch needs a clean way to reach your samples one at a time. That front door is a Dataset class. 🚪

Start by Subclassing

You build a custom dataset by subclassing torch.utils.data.Dataset. PyTorch then knows exactly how to ask your object for data.

from torch.utils.data import Dataset

class MyData(Dataset):
    pass

All lessons in this course

  1. Write a Custom Dataset Class
  2. Batching, Shuffling & num_workers
  3. collate_fn for Variable-Length Inputs
  4. Normalize and Standardize Inputs
← Back to Deep Learning Academy