JuliaDiff / JuliaDiff/ChainRulesCore.jl
document ReverseDiff.jl integration's need to opt-in
Open
Nobody has claimed this yet.
documentation
- Dominant language
- Julia
- Stars
- 267
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
From Slack:
[Fredrik Bagge Carlson](https://app.slack.com/team/UJ7DVTVQ8) [Today at 3:48 PM](https://julialang.slack.com/archives/C6G240ENA/p1646063331166529)
I'm looking at
https://juliadiff.org/ChainRulesCore.jl/stable/index.html#ChainRules-roll-out-status
and it seems like ReverseDiff.jl is supposed to work with ChainRules, but i can't seem to figure out how, my rules are never called
4 replies
[Seth Axen](https://app.slack.com/team/UHDQQ4GN6):axe: [7 minutes ago](https://julialang.slack.com/archives/C6G240ENA/p1646063442894469?thread_ts=1646063331.166529&cid=C6G240ENA)
By default ReverseDiff opts out of all rules for now. Use https://github.com/JuliaDiff/ReverseDiff.jl/blob/df0067465ca436b05377054ac7a184da691db1a3/src/macros.jl#L298-L315 to opt-in on a per-rule basis.
[Fredrik Bagge Carlson](https://app.slack.com/team/UJ7DVTVQ8) [6 minutes ago](https://julialang.slack.com/archives/C6G240ENA/p1646063506399249?thread_ts=1646063331.166529&cid=C6G240ENA)
ok thanks for answering :slightly_smiling_face: Perhaps that should be made clear in the docs for chain rules? I couldn't find anything in the docs for RD either
[Seth Axen](https://app.slack.com/team/UHDQQ4GN6):axe: [5 minutes ago](https://julialang.slack.com/archives/C6G240ENA/p1646063571928219?thread_ts=1646063331.166529&cid=C6G240ENA)
Yeah, the CR docs could be made more specific there. RD should document it. Not certain if this is considered an API macro.
[Fredrik Bagge Carlson](https://app.slack.com/team/UJ7DVTVQ8) [2 minutes ago](https://julialang.slack.com/archives/C6G240ENA/p1646063717720879?thread_ts=1646063331.166529&cid=C6G240ENA)
It looks like the macro has some scoping issue
julia> ControlSystems
ControlSystems
julia> ReverseDiff.@grad_from_chainrules RobustAndOptimalControl.hinfnorm2(T::ControlSystems.StateSpace{Continuous, ReverseDiff.TrackedReal})
ERROR: UndefVarError: ControlSystems not defined
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/ReverseDiff/Y5qec/src/macros.jl:324
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 with the ChainRules roll-out status documentation linked in the issue, then review the ReverseDiff macros.jl section around lines 298-315 and the reported error at line 324. Document that ReverseDiff opts out of rules by default, how the per-rule opt-in is used, and the noted scoping limitation; verify the wording against the existing documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100