JuliaDiff / JuliaDiff/ReverseDiff.jl
Add ChainRulesCore RuleConfig?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 393
- Forks
- 60
- Avg merge
- 18h 24m
- Merged PRs (30d)
- 8
Description
The macro @grad_from_chainrules contains the following line
which shows that the rrule is used with no optional RuleConfig argument. This is proving cumbersome for ImplicitDifferentiation.jl, where the rrule needs to call back into AD and thus dispatch on the AD backend (aka RuleConfig).
Would you be open to a PR defining the following config?
using ChainRulesCore: RuleConfig, HasReverseMode, NoForwardsMode
struct MyReverseDiffRuleConfig <: RuleConfig{Union{HasReverseMode,NoForwardsMode}} end
I would need advice on how to add it to the macro though.
Pinging @mohamed82008
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 in src/macros.jl around line 338, where @grad_from_chainrules calls rrule without a RuleConfig. Read the linked ChainRulesCore RuleConfig documentation and inspect the surrounding macro logic before deciding how the proposed MyReverseDiffRuleConfig should be incorporated. Done means the macro supports the requested config for the ImplicitDifferentiation.jl use case.
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
- 42/100