The hessian function now has an experiemental vectorize flag: torch.autograd.functional.hessian — PyTorch 1.9.0 documentation 3
But that doesn’t have full support for everything right now and the performance might be as high for some ops.