I have a follow up question: what’s the most appropriate way to calculate second derivatives? It sounds like the preferred method is to calculate derivatives with respect to all inputs, and this gets slow when I have to calculate higher order derivatives. Is there a way to calculate derivatives with respect to just one input if I don’t need all of the higher order derivatives?