How can i generate intermediate layer output(third and forth MaxPool layer output) of VGG 16 in pytorch model.
pretrained_model = models.vgg16(pretrained=True)
you can use forward hook as described here: https://discuss.pytorch.org/t/how-can-l-load-my-best-model-as-a-feature-extractor-evaluator/17254/6
Alternatively, subclass the vgg16 model and manipulate its forward function.