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 RF computation and added effective stride and padding #33

Merged
merged 7 commits into from
Oct 24, 2020

Conversation

frgfm
Copy link
Owner

@frgfm frgfm commented Oct 24, 2020

This PR switched back to initial computation order of the receptive field, and add the possibility to display effective stride and padding.

Computing the receptive field of VGG16 with

from torchvision.models import vgg16
from torchscan import summary

model = vgg16().eval().cuda()
summary(model.features, (3, 224, 224), receptive_field=True, max_depth=0)

would yield an incorrect value before the fix:

____________________________________________________________________________
Layer         Type          Output Shape       Param #       Receptive field
============================================================================
sequential    Sequential    (-1, 512, 7, 7)    14,714,688    308            
============================================================================
Trainable params: 14,714,688
Non-trainable params: 0
Total params: 14,714,688
----------------------------------------------------------------------------
Model size (params + buffers): 56.13 Mb
Framework & CUDA overhead: 479.38 Mb
Total RAM usage: 535.51 Mb
----------------------------------------------------------------------------
Floating Point Operations on forward: 30.71 GFLOPs
Multiply-Accumulations on forward: 15.35 GMACs
Direct memory accesses on forward: 15.40 GDMAs
____________________________________________________________________________

After the fix:

____________________________________________________________________________
Layer         Type          Output Shape       Param #       Receptive field
============================================================================
sequential    Sequential    (-1, 512, 7, 7)    14,714,688    212            
============================================================================
Trainable params: 14,714,688
Non-trainable params: 0
Total params: 14,714,688
----------------------------------------------------------------------------
Model size (params + buffers): 56.13 Mb
Framework & CUDA overhead: 479.38 Mb
Total RAM usage: 535.51 Mb
----------------------------------------------------------------------------
Floating Point Operations on forward: 30.71 GFLOPs
Multiply-Accumulations on forward: 15.35 GMACs
Direct memory accesses on forward: 15.40 GDMAs
____________________________________________________________________________

@frgfm frgfm added bug Something isn't working topic: docs Improvements or additions to documentation module: utils Related to utils module: crawler Related to crawler module: test labels Oct 24, 2020
@frgfm frgfm added this to the 0.1.2 milestone Oct 24, 2020
@frgfm frgfm self-assigned this Oct 24, 2020
@frgfm frgfm mentioned this pull request Oct 24, 2020
@codecov
Copy link

codecov bot commented Oct 24, 2020

Codecov Report

Merging #33 into master will increase coverage by 0.24%.
The diff coverage is 86.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #33      +/-   ##
==========================================
+ Coverage   90.04%   90.29%   +0.24%     
==========================================
  Files           9        9              
  Lines         603      608       +5     
==========================================
+ Hits          543      549       +6     
+ Misses         60       59       -1     
Impacted Files Coverage Δ
torchscan/utils.py 75.60% <81.25%> (+1.88%) ⬆️
torchscan/crawler.py 82.08% <100.00%> (ø)
torchscan/modules/receptive.py 100.00% <100.00%> (ø)

@frgfm frgfm merged commit 2cec3f6 into master Oct 24, 2020
@frgfm frgfm deleted the rf-fix branch October 24, 2020 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module: crawler Related to crawler module: utils Related to utils topic: docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant