1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with PyTorch

Exercise

Counting the number of parameters

Deep learning models are famous for having a lot of parameters. Recent language models have billions of parameters. With more parameters comes more computational complexity and longer training times, and a deep learning practitioner must know how many parameters their model has.

In this exercise, you will calculate the number of parameters in your model, first using PyTorch then manually.

The torch.nn package has been imported as nn.

Instructions 1/2

undefined XP
    1
    2
  • Iterate through the model's parameters to update the total variable with the total number of parameters in the model.