Created
August 9, 2020 12:46
-
-
Save brodzik/1f905a924b115a5ca5be1dc836e03593 to your computer and use it in GitHub Desktop.
Get the number of trainable parameters in PyTorch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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