---
# System prepended metadata

title: Count the number of parameters in a model PyTorch

---

# Count the number of parameters in a model PyTorch

```
def count_param(model):
    return sum(param.numel() for param in model.parameters() if param.requires_grad)

count_param(model)
```