Solved by jpeg729 in post #4 
              
              
                Just to check I have understood you correctly… assuming you are calculating the gradient of some Loss function… your gradient calculation is this, right? 
d_Loss/d_input = (output / input) * d_Loss/d_output 
The easiest way to do this would be to implement a custom function rather than using a hook.…