-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inference check failure in test_rrule, @inferred rrule works #246
Comments
|
Thanks. Indeed it does, but it seems to be coming from the julia> g, pbg = @inferred rrule_via_ad(ChainRulesTestUtils.TestConfig(), one_one_core, 1.0, 2.0)
(162761.18047510285, ChainRulesTestUtils.var"#f_pb#43"{ChainRulesTestUtils.TestConfig, Tuple{Bool, Bool, Bool}, Tuple{typeof(one_one_core), Float64, Float64}, ChainRulesTestUtils.var"#call#42"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}(ChainRulesTestUtils.TestConfig(FiniteDifferences.AdaptedFiniteDifferenceMethod{5, 1, FiniteDifferences.UnadaptedFiniteDifferenceMethod{7, 5}}(SVector{5,Int64}(-2, -1, 0, 1, 2), SVector{5,Float64}(0.08333333333333333, -0.6666666666666666, 0.0, 0.6666666666666666, -0.08333333333333333), (SVector{5,Float64}(-0.08333333333333333, 0.5, -1.5, 0.8333333333333334, 0.25), SVector{5,Float64}(0.08333333333333333, -0.6666666666666666, 0.0, 0.6666666666666666, -0.08333333333333333), SVector{5,Float64}(-0.25, -0.8333333333333334, 1.5, -0.5, 0.08333333333333333)), 10.0, 1.0, Inf, 0.05555555555555555, 1.4999999999999998, FiniteDifferences.UnadaptedFiniteDifferenceMethod{7, 5}(SVector{7,Int64}(-3, -2, -1, 0, 1, 2, 3), SVector{7,Float64}(-0.5, 2.0, -2.5, 0.0, 2.5, -2.0, 0.5), (SVector{7,Float64}(0.5, -4.0, 12.5, -20.0, 17.5, -8.0, 1.5), SVector{7,Float64}(-0.5, 2.0, -2.5, 0.0, 2.5, -2.0, 0.5), SVector{7,Float64}(-1.5, 8.0, -17.5, 20.0, -12.5, 4.0, -0.5)), 10.0, 1.0, Inf, 0.5365079365079365, 10.0))), (true, false, false), (ImplicitAD.one_one_core, 1.0, 2.0), ChainRulesTestUtils.var"#call#42"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())))
julia> @code_warntype pbg(1.0)
MethodInstance for (::ChainRulesTestUtils.var"#f_pb#43"{ChainRulesTestUtils.TestConfig, Tuple{Bool, Bool, Bool}, Tuple{typeof(one_one_core), Float64, Float64}, ChainRulesTestUtils.var"#call#42"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}})(::Float64)
from (::ChainRulesTestUtils.var"#f_pb#43")(ȳ) in ChainRulesTestUtils at /home/tamas/.julia/packages/ChainRulesTestUtils/vWKSm/src/rule_config.jl:39
Arguments
#self#::ChainRulesTestUtils.var"#f_pb#43"{ChainRulesTestUtils.TestConfig, Tuple{Bool, Bool, Bool}, Tuple{typeof(one_one_core), Float64, Float64}, ChainRulesTestUtils.var"#call#42"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}
ȳ::Float64
Body::Tuple
1 ─ %1 = Core.getfield(#self#, :config)::ChainRulesTestUtils.TestConfig
│ %2 = Base.getproperty(%1, :fdm)::Any
│ %3 = Core.getfield(#self#, :call)::Core.Const(ChainRulesTestUtils.var"#call#42"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}()))
│ %4 = Core.getfield(#self#, :primals)::Tuple{typeof(one_one_core), Float64, Float64}
│ %5 = Core.getfield(#self#, :is_ignored)::Tuple{Bool, Bool, Bool}
│ %6 = ChainRulesTestUtils._make_j′vp_call(%2, %3, ȳ, %4, %5)::Tuple
└── return %6 Given the MWE, I wonder if anyone could please dig into this. I am not familiar with the internals of this package. |
Wait, I think that just typing the |
Nope, that fixes the |
Thanks for checking, I'll have time next week to dig into this. For now maybe just set |
Thanks, I appreciate it. |
My current understanding of this issue is: The inference comes from the pullback, in particular the I see two ways around the issue:
I imagine this package wants to be AD-independent? In that case we could still use a particular AD system as a test dependency and use its |
I wrapped up an MWE in ImplicitAD.jl for an
rrule
I defined (see the single test). My issue is thatgives an inference failure, while
is fine.
The text was updated successfully, but these errors were encountered: