How to get separate conv feature map from pretrained ResNet?

What I mean is “Extracting image features” from different layers in ResNet, and I read this post.
I just wonder how this can be done in ResNet. One possible way is to construct a partial model which only use the front layers for forwarding. Are there other ways?
By the way, the Torch version of ResNet has a nice script
to extract features from ResNet. If PyTorch also has a corresponding one will be better.