Skip to content

Instantly share code, notes, and snippets.

@gongzhitaao
Created September 16, 2018 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gongzhitaao/6ab6266dd6b20d08c4c0c7a5c65e87df to your computer and use it in GitHub Desktop.
Save gongzhitaao/6ab6266dd6b20d08c4c0c7a5c65e87df to your computer and use it in GitHub Desktop.
Get output from intermediatelayers
from functools import partial
def foo(self, inp, out, name=''):
log.debug('layer name {}'.format(name))
log.debug('input size {}'.format(inp[0].size()))
log.debug('output size {}'.format(out[0].size()))
bar = partial(foo, name='Conv2d_1a_3x3')
env.net.Conv2d_1a_3x3.register_forward_hook(bar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment