Would you mind sharing the code on how you added the hook? I want to use hooks to generate hidden states with gradients