You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As explored in discussions (e.g., #68), we can introduce a flexible "rule switch" mechanism into DifferentiationInterface.jl (DI) by generalising the existing DifferentiateWith functionality.
The central concept is a macro that allows for the dynamic generation of differentiation rules:
@rule_from_DifferentiateWith is a macro designed to generate new differentiation rules.
AutoTargetAD specifies the automatic differentiation (AD) package for which the new rule is being created (e.g., AutoChainRules).
func_sig represents the signature of the function f along with its argument types (argtypes...) for which the rule is being defined.
backend_to_use indicates another AD package (the "backend") whose capabilities will be leveraged to define the rule for AutoTargetAD.
This approach provides a powerful and general way to establish a "rule switch mechanism." It avoids imposing strict assumptions on the rule interface, unlike systems such as ChainRules, offering greater flexibility.
I'm not sure I understand where you're going with the last part. To me, the whole purpose of having a macro generate rules is to dispense the user from creating a DifferentiateWith object, by making the naked function f differentiable directly?
Uh oh!
There was an error while loading. Please reload this page.
As explored in discussions (e.g., #68), we can introduce a flexible "rule switch" mechanism into
DifferentiationInterface.jl
(DI) by generalising the existingDifferentiateWith
functionality.The central concept is a macro that allows for the dynamic generation of differentiation rules:
In this definition:
@rule_from_DifferentiateWith
is a macro designed to generate new differentiation rules.AutoTargetAD
specifies the automatic differentiation (AD) package for which the new rule is being created (e.g.,AutoChainRules
).func_sig
represents the signature of the functionf
along with its argument types (argtypes...
) for which the rule is being defined.backend_to_use
indicates another AD package (the "backend") whose capabilities will be leveraged to define the rule forAutoTargetAD
.This approach provides a powerful and general way to establish a "rule switch mechanism." It avoids imposing strict assumptions on the rule interface, unlike systems such as
ChainRules
, offering greater flexibility.After #806, we could also do
The text was updated successfully, but these errors were encountered: