Logging and changing activation values outside the forward method

Hi there,

It is possible to log activation values of neurons in a model, or even change them in the forward method.

Is it possible to (i) log and (ii) change activation values of neurons without modifying the underlying code of a model (without modifying the forward method)?

Thanks!

Yes, you can use forward hooks as described here to inspect and manipulate the output activations.

1 Like