where “Theta” is the parameters of the network (i.e. weights) and “f(Theta)” is the output network and “y” is a real label and “x” is the input sample.
would you please give me a tip to do that, by sample code?
how can I compute this in Pytorch during the train of my network?
Thanks.
You can find in this gist a function that shows how to compute the hessian.
But you can compute the dot product with f-y much more efficiently using Rop from this gist. In particular it will take Rop(loss, theta, f(theta) - y).