Subclass nn.Module: __init__ and forward
The standard PyTorch model skeleton.
Models Are Just Classes
In PyTorch, every model is a Python class. You build yours by subclassing nn.Module, the base that powers all networks.
Two Methods Run the Show
A model needs only two methods to work: __init__ sets up the layers, and forward describes how data flows through them.
All lessons in this course
- Subclass nn.Module: __init__ and forward
- Stacking Linear Layers
- nn.Sequential for Quick Models
- Inspect Parameters and Layer Shapes