Want to output intermediate layers from pretrained Resnet 18

I think the issue has been solved in this post.

Alternatively, if you want to remove the last layers and keep the layers till you want link.