Manually giving gradients in Flux.jl

Flux relies on Zygote for autodiff. Zygote now uses ChainRules for the actual set of math rules to define the basic gradients transformations. The preferred way to define custom gradients now is through ChainRulesCore’s rrule:

https://juliadiff.org/ChainRulesCore.jl/stable/#frule-and-rrule

(also see Custom Adjoints · Zygote for the alternative legacy method and a bit more verbose explanation than what I just gave)

1 Like