FiniteDifferences.jl
FiniteDifferences.jl copied to clipboard
Allow keyword arguments and skipping positional arguments
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.