hi @ptrblck , I think the issue is with the output.detach() I am unsure how it is causing an issue because I did these experiments :

Using a dictionary to store the activations :

activation = {}
def get_activation(name):
    def hook(model, input, output):
        activation[name] = output.detach()
    return hook

When I use the above method, I was able to see a lot of zeroes in the activations, which means that the output is an operation of Relu activation.

Using Lambda function :

model.fc.register_forward_hook(lambda m, input, output: print(output))

When I try the same with the method you have mentioned recently of using a lambda function, I am clearly seeing the negative values in the output.
I believe there is some issue with the output.detach() ? Can you weigh in your thoughts?