If you would like to store the output of a certain (internal) layer, you could use forward hooks as described here.