SciML / ADTypes.jl

Repository for automatic differentiation backend types
https://sciml.github.io/ADTypes.jl/
MIT License
36 stars 11 forks source link

Add AutoChainRules(ruleconfig) #21

Closed gdalle closed 4 months ago

gdalle commented 4 months ago

Checklist

Additional context

This PR adds an AutoChainRules AD type. It is built from a RuleConfig to allow calling back into AD with frule_via_ad or rrule_via_ad (see https://juliadiff.org/ChainRulesCore.jl/stable/rule_author/superpowers/ruleconfig.html). It does not inherit from AbstractForwardMode or AbstractReverseMode because it can be both.

A similar pattern was used in AbstractDifferentiation.jl

https://github.com/JuliaDiff/AbstractDifferentiation.jl/blob/2bc18d07eb5038c997a7f9253bc3f1457124710e/src/backends.jl#L64-L66