Hi albanD,
Actually I am also trying to compute hessian of a CNN model’s prediction output w.r.to input vector.
Let’s assume simple task of MNIST classification. We have 1x1x28x28 input vector and 1x10 output tensor
Now my aim is to compute the hessian of a specific class’s pred value w.r.to input .
I want to calculate Jacobian in the dimension of 784x1. For example, calculating Jacobian for classs 2’s pred value should yield a tensor of dim 784x1.
And calculating Hessian for class 2’s pred value should yield a matrix of dimension 784 x 784.
I tried to use the code you have provided but I couldn’t manage to change to the one I need.
Can you please suggest a way to calculate a Hessian matrix with dimension 784 x 784 for this specific case?Assuming I need to calculate hessian for prediction output value of a specific class.