Inspect Parameters and Layer Shapes
See exactly what your model holds.
Look Inside Your Model
Once a model exists, you can peek at every weight it holds. Inspecting the parameters builds trust before you train.
Loop Over parameters()
Call model.parameters() to iterate over every learnable tensor. The optimizer uses this exact same list.
for p in model.parameters():
print(p.shape)All lessons in this course
- Subclass nn.Module: __init__ and forward
- Stacking Linear Layers
- nn.Sequential for Quick Models
- Inspect Parameters and Layer Shapes