ThummeTo / FMIFlux.jl

FMIFlux.jl is a free-to-use software library for the Julia programming language, which offers the ability to place FMUs (fmi-standard.org) everywhere inside of your ML topologies and still keep the resulting model trainable with a standard (or custom) FluxML training process.
MIT License
57 stars 15 forks source link

Using `ChainRulesCore` for adjoint definition #9

Closed rejuvyesh closed 2 years ago

rejuvyesh commented 3 years ago

Using rrule from ChainRules would be a lot more general and allow using other AD frameworks than Zygote.

rejuvyesh commented 3 years ago

https://juliadiff.org/ChainRulesCore.jl/stable/converting_zygoterules.html would be useful.

ThummeTo commented 3 years ago

Thanks! Absolutely, it's on the ToDo-list and even mentioned as future work in the realted publication. We are currently preparing a larger patch, releasing in about 2-3 weeks together with an update for FMI.jl. We will try to consider this point as well.

ThummeTo commented 3 years ago

Probably, the right way today would be to use AbstractDifferentiation.jl?

rejuvyesh commented 3 years ago

@ThummeTo I don't think so. AbstractDifferentiation.jl is more about say switching between Zygote or ForwardDiff or Diffractor that chain together individual rules for function gradients. But here what we are doing is in a sense defining a gradient rule for our function and that should still be ChainRules[Core], I think.

ThummeTo commented 2 years ago

Added ChainRulesCore rrule and frule and ForwardDiff-Fallback in #15