I usually use forward hooks as described here, which can store the intermediate activations. You could then pass these activations to further processing.
I usually use forward hooks as described here, which can store the intermediate activations. You could then pass these activations to further processing.