In case you were using register_backward_hook, note that its behavior was broken for some modules which is why it’s deprecated now. Use register_full_backward_hook now. The docs 5 explain the expected inputs and outputs.