Hi
I am new to Python and do not very familiar with the lambda expression. I know I can register a hook to a weight by doing
h = model.classifier.weight.register_hook(lambda grad: grad * 0.)
But, is there a way to register a hook to only part of the weight. For example, to grad[0].
Thank you.