Skip to content

Instantly share code, notes, and snippets.

@JoshVarty
Created April 17, 2019 02:31
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 JoshVarty/5526fbfc4912d91c319732cd746378d1 to your computer and use it in GitHub Desktop.
Save JoshVarty/5526fbfc4912d91c319732cd746378d1 to your computer and use it in GitHub Desktop.
# Modified from: https://forums.fast.ai/t/confused-by-output-of-hook-output/29514/4
class StoreHook(HookCallback):
def on_train_begin(self, **kwargs):
super().on_train_begin(**kwargs)
self.hists = []
def hook(self, m, i, o):
return o
def on_batch_end(self, train, **kwargs):
if (train):
self.hists.append(self.hooks.stored[0].cpu().histc(40,0,10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment