Created
May 5, 2020 17:17
-
-
Save Blaizzy/378c3fc1a67b4ccb973b46e06db121d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SavedFeatures(): | |
| def __init__(self, m): self.hook = m.register_forward_hook(self.hook_fn) | |
| def hook_fn(self, model, input, output): self.features = output | |
| def remove(self): self.hook.remove() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment