In a MLP neural network, I want to get  partial derivative of the output data with the middle layer data. such as, as shown below: ,i need the partial derivative of Etotal with neto1. i find register_backward_hook can get this value, but i fail to use. below is my code. i do not know the error
1.png865×788 21.6 KB

2.png654×770 16.6 KB

3.png653×701 15.6 KB

4.png772×489 13.4 KB