Hi,
Do I understand correctly that the difference between the hessian value that you computed by hand compared to the one computed with pytorch is in the order of 1e-2 ?
Your code is fairly long (and uses local files) so it is not super easy to reproduce.