Obtain intermediate outputs from pre-trained models

You could use forward hooks as described in this post and register the desired layers using their name.