JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl
test_rrule(sum, iszero, ...) errors
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 50
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
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()
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
Reproduce the failure with test_rrule(sum, iszero, randn(5)) and start in src/testers.jl around lines 168–222, following the call into finite_difference_calls.jl. Trace how the NoTangent output is passed to the finite-difference path and identify the expected handling. Done means this case no longer raises DimensionMismatch and is covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100