Skip to content

Instantly share code, notes, and snippets.

@konverner
Created May 13, 2022 05:43
Show Gist options
  • Save konverner/7445190a9dd187d060b1ec14fb72d2e9 to your computer and use it in GitHub Desktop.
Save konverner/7445190a9dd187d060b1ec14fb72d2e9 to your computer and use it in GitHub Desktop.
count parameters of pytorch model
def count_parameters(model):
return sum(p.numel() for p in model.parameters() if p.requires_grad)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment