Solved by sio277 in post #3 
              
              
                Or, you can use nn.Module.apply method: 
with torch.no_grad():
    def add_hook(module):
        def hook1(module, input, output):
            print("hooker Working")
            t_FM.append(output)
        
        if module is t_model.tbackbone.layer2[1].conv1:
            hooks.append(module.regi…