Thanks! Unfortunately, torch.autograd.grad doesn’t work here because x.grad is not a scalar…
Is there another way? Seems like it should be possible because it seems like the Hessian is being calculated as an intermediate step…