yes, that’s true. Especially, if different layers have different sizes. I was reading through the following and see like it might not even be possible to calculate the Hessian w.r.t all the parameters for all the samples? torch.autograd.functional.* for models · Issue #40480 · pytorch/pytorch · GitHub 2