Solved by mariosasko in post #2 
              
              
                You can achieve that easily with the forward hooks. 
outputs = {}
def save_output(self, input, output):
    outputs[self] = output

model = Resnet18()
model.layer1.register_forward_hook(save_output)
...
model(input)
print(outputs[model.layer1])