How can I obtain the gradient of a gradient?

I don’t know if this question is still relevant, but I included some recursive gradient examples in my post error-by-recursively-calling-jacobian-in-a-for-loop