I have a function that produces 3 outputs where each output is a function of x, y, z. I want to calculate the Hessian of that function with respect to inputs x, y, z. The built-in Hessian takes in a function that produces a single output, so I’m thinking of calling Jacobian twice. However, the first time I call the Jacobian, the inputs are passed in and I get a tensor of numbers, and taking the Jacobian of that gets all 0s. Is there a way to not sub in the numbers the first time Jacobian is called or any other ways to do this? Thanks!
Hi @abc1,
Can you share a minimal reproducible example?
Hi abc!
torch.func.hessian takes a func
that can return a tuple. I believe
that this will do what you want.
Best.
K. Frank
1 Like