In your case, attaching a hook to the layer you want seems easier.
model = models.resnet18()
outputs = []
def hook(module, input, output):
outputs.append(output)
model.layer2.conv1.register_forward_hook (hook)
(Typing from the phone, the code is an approximation and might contain errors)