In your case, you can use torchvision.models._utils.IntermediateLayerGetter.
For example:
import torchvision
from torchvision.models._utils import IntermediateLayerGetter
model = torchvision.models.vgg16()
return_layers = {'8': 'out_layer8', '15': 'out_layer15'}
model_with_multuple_layer = IntermediateLayerGetter(model.features, return_layers=return_layers)
x = torch.rand(5,3,512,512)
y = model_with_multuple_layer(x)

You can see that y contains the output of layer 8 and layer 15 of model.features