Backends

DifferentiationInterface.jl is based on two concepts: operators and backends. This page is about the latter, check out that page to learn about the former.

List of backends

We support all dense backend choices from ADTypes.jl:

We also support the sparse wrapper AutoSparse.

Compatibility

DifferentiationInterface.jl itself is compatible with Julia 1.6, the Long Term Support (LTS) version of the language. However, we were only able to test the following backends on Julia 1.6:

  • AutoFiniteDifferences
  • AutoForwardDiff
  • AutoReverseDiff
  • AutoTracker
  • AutoZygote

We strongly recommend that users upgrade to Julia 1.10 or above, where all backends are tested.

Features

BackendAvailabilityTwo-argument functionsHessian support
AutoDiffractor
AutoEnzyme
AutoFastDifferentiation
AutoFiniteDiff
AutoFiniteDifferences
AutoForwardDiff
AutoPolyesterForwardDiff
AutoReverseDiff
AutoSymbolics
AutoTapir
AutoTracker
AutoZygote

Availability

You can use check_available to verify whether a given backend is loaded.

Support for two-argument functions

All backends are compatible with one-argument functions f(x) = y. Only some are compatible with two-argument functions f!(y, x) = nothing. You can use check_twoarg to verify this compatibility.

Support for Hessian

Only some backends are able to compute Hessians. You can use check_hessian to verify this feature (beware that it will try to compute a small Hessian, so it is not instantaneous like the other checks).

Backend switch

The wrapper DifferentiateWith allows you to switch between backends. It takes a function f and specifies that f should be differentiated with the backend of your choice, instead of whatever other backend the code is trying to use. In other words, when someone tries to differentiate dw = DifferentiateWith(f, backend1) with backend2, then backend1 steps in and backend2 does nothing. At the moment, DifferentiateWith only works when backend2 supports ChainRules.jl.