Visualizing Layer Outputs

in the video of the first video of part 1, there is a slide where the output of each layer is shown. Is there any way to get the output of the layers of our own model?

# 1st run your model with a hook
with hook_outputs([l for l in flatten_model(learn.model)]) as hooks: y_ = learn.model.eval()(x)
hooks.stored # <----- this will have all the outputs

Hi Renato,

Sorry for the very late reply and thanks for your help. I ran the code you mentioned and got this error:
name ‘hook_outputs’ is not defined

Is there anything I am missing here?

import fastai.callbacks.hooks

Add this import:
from fastai.callbacks import *