Skip to content

add error message for integers that represent reals #201

@mzgubic

Description

@mzgubic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions