Solved by ptrblck in post #2 
              
              
                You could iterate all modules, check if the current module is an nn.Conv2d modules, and register the hook using its name. 
Here is a dummy code snippet for resnet: 
model = models.resnet50()
for name, module in model.named_modules():
    if isinstance(module, nn.Conv2d):
        module.register_forw…