Extract feature maps from intermediate layers without modifying forward()

There are many examples in this thread:

Also a search will give you a few more examples:

https://discuss.pytorch.org/search?q=register_hook

1 Like