0Pricing
Deep Learning Academy · Lesson

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

  1. Subclass nn.Module: __init__ and forward
  2. Stacking Linear Layers
  3. nn.Sequential for Quick Models
  4. Inspect Parameters and Layer Shapes
← Back to Deep Learning Academy