Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parameter count #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

luisherrmann
Copy link

@luisherrmann luisherrmann commented Aug 14, 2020

This contribution introduces three mayor changes:

  1. Parameters are now counted using the parameters() function of nn.Module and the numel() function of the nn.parameters.Parameter. This allows for counting the weights of custom modules with other keywords than just weight or bias. The fix addresses issues #95 and #65 .
  2. Trainable parameters are now counted on a separate accumulator using the requires_grad attribute of parameters.
  3. The API is expanded by adding a parameter recurse both to summary() and summary_string(), which is True by default.
    If set, the summary string will only be built for direct children of the model (and the model module itself).

The API extension and the parameter counting fix have both been tested through additional tests that are now included in torchsummary_test.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant