Closed ArnoStrouwen closed 2 months ago
This is the more direct way to do it:
https://github.com/SciML/GalacticOptim.jl/blob/master/src/function.jl#L128-L133
It requires these overloads:
https://github.com/SciML/DiffEqFlux.jl/blob/master/src/DiffEqFlux.jl#L57-L68
It would be good to add this all here.
There are also duplicates of some jacobian free methods in https://github.com/SciML/DiffEqSensitivity.jl/blob/25a5290013433bdadec776fa7b5a92f46e5a1777/src/derivative_wrappers.jl#L118-L123 ?
With all this duplication and scattering of methods, perhaps a DirectionalDerivative package might be a good idea?
It should all just be here, and then those packages should just depend on SparseDiffTools.jl. DiffEqFlux.jl and DiffEqSensitivity.jl just predate SparseDiffTools.jl by some time and haven't been refactored yet.
Note that DifferentiationInterface.jl offers an hvp
function which does exactly that, in a backend-agnostic manner and specializing on the mode combination (it chooses different methods for forward-over-reverse than reverse-over-forward for instance)
this exists
Does these make sense?