Implementer guide
Come back later!
The macro @primitive
To implement the AbstractDifferentiation interface for your backend, you only need to provide a "primitive" from which the rest of the functions can be deduced. However, for performance reasons, you can implement more of the interface to make certain calls faster.
At the moment, the only primitives supported are AD.pushforward_function and AD.value_and_pullback_function. The AD.@primitive macro uses the provided function to implement AD.jacobian, and all the other functions follow.
AD.@primitive function AD.myprimitive(ab::MyBackend, f, xs...)
    # write your code here
endSee the backend-specific extensions in the ext/ folder of the repository for example implementations.
Function dependency graph
These details are not part of the public API and are expected to change. They are just listed here to help readers figure out the code structure:
jacobianhas no default implementationderivativecallsjacobiangradientcallsjacobianhessiancallsjacobianandgradientvalue_and_jacobiancallsjacobianvalue_and_derivativecallsvalue_and_jacobianvalue_and_gradientcallsvalue_and_jacobianvalue_and_hessiancallsjacobianandgradientvalue_gradient_and_hessiancallsvalue_and_jacobianandgradientpushforward_functioncallsjacobianvalue_and_pushforward_functioncallspushforward_functionpullback_functioncallsvalue_and_pullback_functionvalue_and_pullback_functioncallsgradient