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: Fixed support of modules that are used multiple times during forward #24

Merged
merged 11 commits into from
Aug 5, 2020

Conversation

frgfm
Copy link
Owner

@frgfm frgfm commented Aug 5, 2020

This PR handles the cases where a single module is reused multiple times. The issue was that with the initial hooking mechanism, the module gets hooked N times, and upon the forward pass, it will trigger N hooks each time the module is used. This was handled by:

  • setting a hook tracker for each hook type
  • also added support of torch.nn.Flatten
  • updating unittests
  • fixed requirements

@frgfm frgfm added type: improvement New feature or request module: crawler Related to crawler module: modules Related to modules topic: build Related to project build module: test labels Aug 5, 2020
@frgfm frgfm added this to the 0.1.2 milestone Aug 5, 2020
@frgfm frgfm self-assigned this Aug 5, 2020
@codecov
Copy link

codecov bot commented Aug 5, 2020

Codecov Report

Merging #24 into master will decrease coverage by 0.28%.
The diff coverage is 82.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #24      +/-   ##
==========================================
- Coverage   89.75%   89.46%   -0.29%     
==========================================
  Files           9        9              
  Lines         527      560      +33     
==========================================
+ Hits          473      501      +28     
- Misses         54       59       +5     
Impacted Files Coverage Δ
torchscan/crawler.py 82.08% <80.55%> (+0.18%) ⬆️
torchscan/modules/flops.py 99.01% <100.00%> (ø)
torchscan/modules/macs.py 100.00% <100.00%> (ø)
torchscan/modules/memory.py 100.00% <100.00%> (ø)
torchscan/modules/receptive.py 100.00% <100.00%> (ø)

@frgfm frgfm merged commit 4db02c1 into master Aug 5, 2020
@frgfm frgfm deleted the post-release branch August 5, 2020 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: crawler Related to crawler module: modules Related to modules topic: build Related to project build type: improvement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant