Yes, these functions work with functions in general and don’t know about specific constructs like “batch”.
You will have to define a function that takes inputs of size (10) and outputs of size (10), and run hessian for each element in the batch. (The same way all the others constructs in torch.autograd don’t know about batch).