Preparation

Preparation is a backend-specific procedure which involves some subtleties. Here we list the broad principles of preparation for each backend where it is nontrivial.

The following is not part of the public API.

Warning

This page may become outdated, in which case you should refer to the source code as the ground truth.

ChainRulesCore

For pullback, same-point preparation runs the forward sweep and returns the pullback closure.

Enzyme

In forward mode, for gradient and jacobian

FastDifferentiation

Preparation generates an executable function from the symbolic expression of the differentiated function.

FiniteDiff

Whenever possible, preparation creates a cache object.

ForwardDiff

Wherever possible, preparation creates a config with all the necessary memory to use as buffer. For pushforward, preparation allocates the necessary space for Dual number computations.

ReverseDiff

Wherever possible, preparation records a tape of the function's execution.

Warning

This tape is specific to the control flow inside the function, and cannot be reused if the control flow is value-dependent (like if x[1] > 0).

Symbolics

Preparation generates an executable function from the symbolic expression of the differentiated function.

Tapir

For pullback, preparation builds the reverse rule of the function.

Tracker

For pullback, same-point preparation runs the forward sweep and returns the pullback closure at x.

Zygote

For pullback, same-point preparation runs the forward sweep and returns the pullback closure at x.