Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Failure with ComposedFunction `∘`

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

还没有人认领这个 Issue。

  • #73 来自 @mcabbott —— 已关闭,未合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
julia
领域
devtools

调研方向

使用 issue 中所示的两个 Diffractor.gradient 调用重现该故障。先从 src/stage1/generated.jl 的第 288-308 行附近和 src/interface.jl 的第 122-128 行附近开始,然后查看链接的 ChainRulesCore pull request。当 gradient(identity∘cbrt, 1.23) 在没有 Tangent backing 错误的情况下完成,并保留可正常工作的直接 cbrt 结果时,即视为完成。

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

描述

I'm pretty confident this worked in September, but have no idea whether changes here or in ChainRules broke it: Edit -- the change is https://github.com/JuliaDiff/ChainRulesCore.jl/pull/495, discussed there.

julia> Diffractor.gradient(cbrt, 1.23)
(0.29036348772107673,)

julia> Diffractor.gradient(identity∘cbrt, 1.23)
ERROR: ArgumentError: Tangent for the primal Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}} should be backed by a AbstractDict type, not by NamedTuple{(:data,), Tuple{ChainRulesCore.ZeroTangent}}.
Stacktrace:
  [1] _backing_error(P::Type, G::Type, E::Type)
    @ ChainRulesCore ~/.julia/packages/ChainRulesCore/qzYOG/src/tangent_types/tangent.jl:62
  [2] ChainRulesCore.Tangent{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, NamedTuple{(:data,), Tuple{ChainRulesCore.ZeroTangent}}}(backing::NamedTuple{(:data,), Tuple{ChainRulesCore.ZeroTangent}})
    @ ChainRulesCore ~/.julia/packages/ChainRulesCore/qzYOG/src/tangent_types/tangent.jl:33
  [3] (::Diffractor.var"#162#164"{Symbol, DataType})(Δ::ChainRulesCore.ZeroTangent)
    @ Diffractor ~/.julia/packages/Diffractor/HYuxt/src/stage1/generated.jl:308
  [4] (::Diffractor.EvenOddOdd{1, 1, Diffractor.var"#162#164"{Symbol, DataType}, Diffractor.var"#163#165"{Symbol}})(Δ::ChainRulesCore.ZeroTangent)
    @ Diffractor ~/.julia/packages/Diffractor/HYuxt/src/stage1/generated.jl:288
  [5] ∂⃖¹₁merge
    @ ./none:1
  [6] ∂⃖¹₁
    @ ./none:1
  [7] (::Diffractor.ApplyOdd{1, 1})(Δ::Float64)
    @ Diffractor ~/.julia/packages/Diffractor/HYuxt/src/stage1/generated.jl:371
  [8] ∂⃖¹₁ComposedFunction
    @ ./none:1
  [9] (::Diffractor.∇{ComposedFunction{typeof(identity), typeof(cbrt)}})(args::Float64)
    @ Diffractor ~/.julia/packages/Diffractor/HYuxt/src/interface.jl:122
 [10] Diffractor.∇(::Function, ::Float64)
    @ Diffractor ~/.julia/packages/Diffractor/HYuxt/src/interface.jl:128
 [11] top-level scope
    @ REPL[3]:1
主要语言
Julia
星标
453
派生
33
PR 合并指标
30 天内没有已合并 PR

环境准备

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

从这里开始

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

JuliaDiff/Diffractor.jl 的其他 Issue

查看 JuliaDiff/Diffractor.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

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