document ReverseDiff.jl integration's need to opt-in

未关闭
#548 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
45/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
julia
领域
documentation

调研方向

先查看 issue 中链接的 ChainRules 推出状态文档,然后检查 macros.jl 中 ReverseDiff 在第 298-315 行附近的部分,以及第 324 行报告的错误。记录 ReverseDiff 默认不启用规则、如何使用逐条规则 opt-in,以及所指出的作用域限制;根据现有文档核对措辞。

由索引模型根据 Issue 内容生成。

描述

documentation

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
主要语言
Julia
星标
267
派生
66
平均合并
1 天 1 小时
30 天内合并 PR
9

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JuliaDiff/ChainRulesCore.jl 的其他 Issue

查看 JuliaDiff/ChainRulesCore.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。