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

test_rrule(sum, iszero, ...) errors

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

还没有人认领这个 Issue。

评估

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

调研方向

使用 test_rrule(sum, iszero, randn(5)) 重现失败,并从 src/testers.jl 的第 168–222 行附近开始,跟踪调用进入 finite_difference_calls.jl 的过程。追踪 NoTangent 输出如何传递到有限差分路径,并确定预期的处理方式。当此案例不再引发 DimensionMismatch,且已有适当的回归测试覆盖时,即视为完成。

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

描述

Error is:

julia> using ChainRules, ChainRulesTestUtils

julia> test_rrule(sum, iszero, randn(5))
test_rrule: sum on typeof(iszero),Vector{Float64}: Error During Test at /home/oxinabox/.julia/packages/ChainRulesTestUtils/f5cNH/src/testers.jl:191
  Got exception outside of a @test
  DimensionMismatch("second dimension of A, 1, does not match length of x, 0")
  Stacktrace:
    [1] gemv!(y::Vector{Float64}, tA::Char, A::Matrix{Float64}, x::Vector{Float64}, α::Bool, β::Bool)
      @ LinearAlgebra /usr/local/src/julia/julia-1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/matmul.jl:530
    [2] mul!
      @ /usr/local/src/julia/julia-1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/matmul.jl:97 [inlined]
    [3] mul!
      @ /usr/local/src/julia/julia-1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/matmul.jl:275 [inlined]
    [4] *(transA::LinearAlgebra.Transpose{Float64, Matrix{Float64}}, x::Vector{Bool})
      @ LinearAlgebra /usr/local/src/julia/julia-1.6/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/matmul.jl:87
    [5] _j′vp(fdm::FiniteDifferences.AdaptedFiniteDifferenceMethod{5, 1, FiniteDifferences.UnadaptedFiniteDifferenceMethod{7, 5}}, f::Function, ȳ::Vector{Bool}, x::Vector{Float64})
      @ FiniteDifferences ~/.julia/packages/FiniteDifferences/W3rQO/src/grad.jl:80
    [6] j′vp(fdm::FiniteDifferences.AdaptedFiniteDifferenceMethod{5, 1, FiniteDifferences.UnadaptedFiniteDifferenceMethod{7, 5}}, f::Function, ȳ::NoTangent, x::Vector{Float64})
      @ FiniteDifferences ~/.julia/packages/FiniteDifferences/W3rQO/src/grad.jl:73
    [7] _make_j′vp_call(fdm::Any, f::Any, ȳ::Any, xs::Any, ignores::Any)
      @ ChainRulesTestUtils ~/.julia/packages/ChainRulesTestUtils/f5cNH/src/finite_difference_calls.jl:51
    [8] macro expansion
      @ ~/.julia/packages/ChainRulesTestUtils/f5cNH/src/testers.jl:222 [inlined]
    [9] macro expansion
      @ /usr/local/src/julia/julia-1.6/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
   [10] test_rrule(::RuleConfig, ::Any, ::Any, ::Vararg{Any, N} where N; output_tangent::Any, check_thunked_output_tangent::Any, fdm::Any, rrule_f::Any, check_inferred::Bool, fkwargs::NamedTuple, rtol::Real, atol::Real, kwargs::Any)
      @ ChainRulesTestUtils ~/.julia/packages/ChainRulesTestUtils/f5cNH/src/testers.jl:194
   [11] test_rrule
      @ ~/.julia/packages/ChainRulesTestUtils/f5cNH/src/testers.jl:186 [inlined]
   [12] #test_rrule#47
      @ ~/.julia/packages/ChainRulesTestUtils/f5cNH/src/testers.jl:168 [inlined]
   [13] test_rrule(::Any, ::Any, ::Any)
      @ ChainRulesTestUtils ~/.julia/packages/ChainRulesTestUtils/f5cNH/src/testers.jl:167

I assume it is something to do with the fact that the everything including the output, has the determined tangent of NoTangent()

主要语言
Julia
星标
50
派生
18
PR 合并指标
30 天内没有已合并 PR

环境准备

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

从这里开始

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

JuliaDiff/ChainRulesTestUtils.jl 的其他 Issue

查看 JuliaDiff/ChainRulesTestUtils.jl 的全部 Issue

相似的 Issue

更多 Julia Issue

把新 issue 发到你的邮箱

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