JuliaDiff / JuliaDiff/FiniteDifferences.jl
Allow keyword arguments and skipping positional arguments
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 318
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the j′vp entry point and read the workaround in test/test_util.jl, especially how it handles keyword and skipped positional arguments. Compare that approach with the current j′vp signature and the sum example using dims=1. Done means callers can express those arguments directly without a wrapper, with coverage for the demonstrated cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100