Skip to content

Instantly share code, notes, and snippets.

@IAmSuyogJadhav
Created January 12, 2021 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IAmSuyogJadhav/56e51900e3e1632dffd7767eb377d351 to your computer and use it in GitHub Desktop.
Save IAmSuyogJadhav/56e51900e3e1632dffd7767eb377d351 to your computer and use it in GitHub Desktop.
Count and display the total no. of parameters in a PyTorch model.
# model is your pytorch model (an nn.Module instance)
pytorch_total_params = sum(p.numel() for p in model.parameters())
print(pytorch_total_params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment