JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl
add error message for integers that represent reals
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 50
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
e.g. example by @SomTambe
julia> f(x) = 8x + 10*sin(x)
f (generic function with 1 method)
julia> function ChainRulesCore.rrule(::typeof(f), x)
y = f(x)
function ∇f(Δ)
∇ = 8 + 10*cos(x)
@show ∇ Δ
return ChainRulesCore.NoTangent(), Δ * ∇
end
return y, ∇f
end
julia> test_rrule(f, 2);
∇ = 3.838531634528576
Δ = 2.31
∇ = 3.838531634528576
Δ = 2.31
test_rrule: f on Int64: Test Failed at /home/somvt/.julia/packages/ChainRulesTestUtils/AX7fv/src/testers.jl:278
Expression: ad_cotangent isa NoTangent
Evaluated: 8.86700807576101 isa NoTangent
...
Test Summary: | Pass Fail Total
test_rrule: f on Int64 | 4 1 5
ERROR: Some tests did not pass: 4 passed, 1 failed, 0 errored, 0 broken.
the error message is confusing, we could special case it for actual::AbstractFloat, expected::NoTangent as suggested by @oxinabox
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 shown failure with test_rrule(f, 2) and start at the tester entry point reported as testers.jl:278. Review the actual::AbstractFloat and expected::NoTangent case suggested in the issue, then verify that the resulting failure message clearly explains the integer-input mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100