Hi,

I am confused about the interfaces as the hessian requires “sequences"

Not sure what you mean here?
If you function takes a single input, you can just give that to “hessian” and if it takes multiple of them, you can just pass a tuple containing all of them. hessian(model, x) in your case should work fine no?

RuntimeError: grad can be implicitly created only for scalar outputs

autograd.grad() is just running backward mode AD. And so it will create the grad_outputs for you only if the output, u in your case, is a scalar. In other cases, you will need to provide it explicitly with the value that fits what you want to get.