Fab, thanks for this. I’ve played around and found autograd.functional.jacobian(..., create_graph=True) is an awful lot more expensive in comparison to my posted method - hopefully there’ll be a solution that is both elegant and cheap soon!