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 the following dense backend choices from ADTypes.jl:
AutoChainRules
AutoDiffractor
AutoEnzyme
AutoFastDifferentiation
AutoFiniteDiff
AutoFiniteDifferences
AutoForwardDiff
AutoPolyesterForwardDiff
AutoReverseDiff
AutoSymbolics
AutoTapir
AutoTracker
AutoZygote
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
Given a backend object, you can use:
check_available
to know whether the required AD package is loadedcheck_inplace
to know whether the backend supports in-place functions (all backends support out-of-place functions)
Backend | Availability | In-place functions |
---|---|---|
AutoChainRules | ✅ | ❌ |
AutoDiffractor | ✅ | ❌ |
AutoEnzyme | ✅ | ✅ |
AutoFastDifferentiation | ✅ | ✅ |
AutoFiniteDiff | ✅ | ✅ |
AutoFiniteDifferences | ✅ | ❌ |
AutoForwardDiff | ✅ | ✅ |
AutoPolyesterForwardDiff | ✅ | ✅ |
AutoReverseDiff | ✅ | ✅ |
AutoSymbolics | ✅ | ✅ |
AutoTapir | ✅ | ✅ |
AutoTracker | ✅ | ❌ |
AutoZygote | ✅ | ❌ |
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.