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

Splatting arrays

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

还没有人认领这个 Issue。

评估

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

调研方向

在 Julia REPL 中重现 tuple 和 vector splat 示例,然后检查 stage1/generated.jl 的 stack-trace 路径以及 interface.jl 中的入口点。确定通过 Core._apply_iterate 进行的 array splat 与 tuple splat 相比是如何处理的。完成的标准是 vector 示例返回正确的 gradient,并且包含一个 regression test。

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

描述

Diffractor doesn't seem to like array splats:

julia> gradient(x -> max(x...), (1,2,3))[1]
(0.0, 0.0, 1.0)

julia> gradient(x -> max(x...), [1,2,3])[1]
ERROR: MethodError: no method matching (::Diffractor.∂⃖recurse{1})(::typeof(Core._apply_iterate), ::typeof(iterate), ::typeof(max), ::Vector{Int64})
Closest candidates are:
  (::Diffractor.∂⃖recurse)(::Any...) at /Users/me/.julia/packages/Diffractor/2Ott3/src/stage1/generated.jl:398
Stacktrace:
  [1] macro expansion
    @ ~/.julia/packages/Diffractor/2Ott3/src/stage1/generated.jl:0 [inlined]
  [2] (::Diffractor.∂⃖recurse{1})(::typeof(Core._apply_iterate), ::typeof(iterate), ::typeof(max), ::Vector{Int64})
    @ Diffractor ~/.julia/packages/Diffractor/2Ott3/src/stage1/generated.jl:407
  [3] (::∂⃖{1})(::typeof(Core._apply_iterate), ::Function, ::Vararg{Any})
    @ Diffractor ~/.julia/packages/Diffractor/2Ott3/src/stage1/generated.jl:214
  [4] #9
    @ ./REPL[6]:1 [inlined]
  [5] (::Diffractor.∂⃖recurse{1})(::var"#9#10", ::Vector{Int64})
    @ Diffractor ~/.julia/packages/Diffractor/2Ott3/src/stage1/generated.jl:0
  [6] (::∂⃖{1})(f::var"#9#10", args::Vector{Int64})
    @ Diffractor ~/.julia/packages/Diffractor/2Ott3/src/stage1/generated.jl:214
  [7] ∂⃖(::Function, ::Vararg{Any})
    @ Diffractor ~/.julia/packages/Diffractor/2Ott3/src/interface.jl:25
  [8] (::Diffractor.∇{var"#9#10"})(args::Vector{Int64})
    @ Diffractor ~/.julia/packages/Diffractor/2Ott3/src/interface.jl:121
  [9] Diffractor.∇(::Function, ::Vector{Int64})
    @ Diffractor ~/.julia/packages/Diffractor/2Ott3/src/interface.jl:128

Zygote also gets this wrong: https://github.com/FluxML/Zygote.jl/issues/599

主要语言
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 摘要。