How to extract features from specfic layers of ResNet-152?

l would like to use ReNet-152 as a feature extractor (for new input images) from a specific layers let’s say layer 1, 18, 52, 97, 123 and 149.
The following code allows to extract features from last hidden layer (fully connected)
My question is how can l get access to specific layers and extract features from the specified layer ?
import torch
import numpy as np
import torch.nn as nn
import torchvision.models as models
from torch.autograd import Variable
from torchvision.transforms import ToTensor
from PIL import Image
import glob as glob
import os

    resnet152 = models.resnet152(pretrained=True)

Thank you

You can register a forward hook on the particular layer of interest.