I’m trying to calculate the diagonal sum of the Hessian matrix w.r.t. input.
I’m working based on @apaszke 's code 14.
But when I tested the code, it was really slow.
I think that is because of their code loops over all elements in the y matrix, and it isn’t what I want.
What I want to do is to calculate the diagonal sum of Hessian matrix per element in a batch. Is there any faster way to do this?