FiniteDifferences.jl icon indicating copy to clipboard operation
FiniteDifferences.jl copied to clipboard

Allow keyword arguments and skipping positional arguments

Open ararslan opened this issue 6 years ago • 0 comments

Something I ran into in ChainRules was that FDM's j′vp currently cannot deal with non-numeric, non-differentiable arguments, nor can it deal with keyword arguments. One example of that is sum with a function argument and/or with the dims keyword argument. You can wrap it yourself like

FDM.j′vp(central_fdm(5, 1), x->sum(abs2, x, dims=1), ȳ, x)

but it would be nice to have a way to express this directly in the j′vp function signature.

To get around this limitation I implemented this monstrocity: https://github.com/JuliaDiff/ChainRules.jl/blob/master/test/test_util.jl#L53-L78, but that should never see the light of day beyond being used in tests.

ararslan avatar Jun 20 '19 17:06 ararslan