Thanks @anantguptadbl for your reply. I am familiar with the hook. But I am not sure how to apply the modifications on the actual tensor. Hook can records the values on an external list. However I want after computing the gradients by loss.backward(), add some values to each gradients computed and then call optimizer.step()
if you have any idea, I appreciate it.
Thanks