Open
Description
When using test_scalar
to test functions with multiple outputs the error messages are uninformative:
julia> simo(x) = (x, 2x)
julia> @scalar_rule simo(x) 1.0 2.0
julia> test_scalar(simo, 3.0)
Test Summary: | Pass Total
simo at 3.0, with tangent 1.0 | 3 3
ERROR: MethodError: no method matching one(::Tuple{Float64,Float64})
Closest candidates are:
one(::Type{Missing}) at missing.jl:103
one(::BitArray{2}) at bitarray.jl:400
one(::Missing) at missing.jl:100
...
Stacktrace:
[1] #test_scalar#26(::Float64, ::Float64, ::FiniteDifferences.FiniteDifferenceMethod{Array{Int64,1},Array{Float64,1},FiniteDifferences.var"#27#29"{FiniteDifferences.FiniteDifferenceMethod{Array{Int64,1},Array{Float64,1},FiniteDifferences.var"#default_bound_estimator#19"{Int64}}}}, ::NamedTuple{(),Tuple{}}, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(test_scalar), ::typeof(simo), ::Float64) at /Users/mzgubic/Projects/ChainRules.jl/dev/ChainRulesTestUtils/src/testers.jl:154
[2] test_scalar(::Function, ::Float64) at /Users/mzgubic/Projects/ChainRules.jl/dev/ChainRulesTestUtils/src/testers.jl:125
[3] top-level scope at REPL[23]:1
We could also support multiple outputs though I don't think it is a priority given rrule_test
and frule_test
are available.