-
Notifications
You must be signed in to change notification settings - Fork 31
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
remove the hack #129
remove the hack #129
Conversation
It looks like we no longer need the hack..
@@ -226,8 +226,7 @@ z45, delta45 = frule_via_ad(DiffractorRuleConfig(), (0,1), x -> log(exp(x)), 2) | |||
@test gradient(x -> sum(sqrt.(atan.(x, transpose(x)))), [1,2,3])[1] ≈ [0.2338, -0.0177, -0.0661] atol=1e-3 | |||
@test gradient(x -> sum(exp.(log.(x))), [1,2,3]) == ([1,1,1],) | |||
|
|||
# XXX the world-age limitation is preventing this test from passing | |||
# @test gradient(x -> sum((exp∘log).(x)), [1,2,3]) == ([1,1,1],) # frule_via_ad | |||
@test_broken gradient(x -> sum((exp∘log).(x)), [1,2,3]) == ([1,1,1],) # frule_via_ad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case causes BoundsError
now, which makes me doubt this is related to world-age anymore.
julia> using Diffractor
julia> gradient(x -> sum((exp∘log).(x)), [1,2,3])
ERROR: BoundsError: attempt to access Tuple{Diffractor.TangentBundle{1, ComposedFunction{typeof(exp), typeof(log)}, Diffractor.ExplicitTangent{Tuple{ChainRulesCore.NoTangent}}}, Diffractor.TangentBundle{1, Int64, Diffractor.ExplicitTangent{Tuple{Int64}}}} at index [3]
Stacktrace:
[1] (::Diffractor.∂☆recurse{1})(::Diffractor.TangentBundle{1, ComposedFunction{typeof(exp), typeof(log)}, Diffractor.ExplicitTangent{Tuple{ChainRulesCore.NoTangent}}}, ::Diffractor.TangentBundle{1, Int64, Diffractor.ExplicitTangent{Tuple{Int64}}})
@ Diffractor ~/julia/packages/Diffractor/src/stage1/recurse_fwd.jl:53
[2] (::Diffractor.∂☆internal{1})(::Diffractor.TangentBundle{1, ComposedFunction{typeof(exp), typeof(log)}, Diffractor.ExplicitTangent{Tuple{ChainRulesCore.NoTangent}}}, ::Vararg{Diffractor.AbstractTangentBundle{1}})
@ Diffractor ~/julia/packages/Diffractor/src/stage1/forward.jl:112
[3] frule_via_ad(::Diffractor.DiffractorRuleConfig, ::Tuple{ChainRulesCore.NoTangent, Int64}, ::Function, ::Vararg{Any})
@ Diffractor ~/julia/packages/Diffractor/src/stage1/forward.jl:120
[4] (::ChainRules.var"#1733#1735"{typeof(ChainRulesCore.frule_via_ad), Diffractor.DiffractorRuleConfig, ComposedFunction{typeof(exp), typeof(log)}})(a::Int64)
@ ChainRules ~/.julia/packages/ChainRules/RZYEu/src/rulesets/Base/broadcast.jl:109
[5] _broadcast_getindex_evalf
@ ./broadcast.jl:697 [inlined]
[6] _broadcast_getindex
@ ./broadcast.jl:670 [inlined]
[7] getindex
@ ./broadcast.jl:624 [inlined]
[8] iterate
@ ./broadcast.jl:261 [inlined]
[9] iterate
@ ./broadcast.jl:255 [inlined]
[10] #collect_structarray#94
@ ~/.julia/packages/StructArrays/F5fDf/src/collect.jl:39 [inlined]
[11] collect_structarray
@ ~/.julia/packages/StructArrays/F5fDf/src/collect.jl:37 [inlined]
[12] #StructArray#29
@ ~/.julia/packages/StructArrays/F5fDf/src/structarray.jl:255 [inlined]
[13] StructArray
@ ~/.julia/packages/StructArrays/F5fDf/src/structarray.jl:254 [inlined]
[14] unzip_broadcast
@ ~/.julia/packages/ChainRules/RZYEu/src/unzipped.jl:39 [inlined]
[15] split_bc_inner
@ ~/.julia/packages/ChainRules/RZYEu/src/rulesets/Base/broadcast.jl:108 [inlined]
[16] split_bc_forwards
@ ~/.julia/packages/ChainRules/RZYEu/src/rulesets/Base/broadcast.jl:104 [inlined]
[17] rrule
@ ~/.julia/packages/ChainRules/RZYEu/src/rulesets/Base/broadcast.jl:41 [inlined]
[18] ∂⃖
@ ~/julia/packages/Diffractor/src/stage1/generated.jl:207 [inlined]
[19] ∂⃖
@ ~/julia/packages/Diffractor/src/stage1/generated.jl:372 [inlined]
[20] broadcasted
@ ./broadcast.jl:1325 [inlined]
[21] (::Diffractor.∂⃖recurse{1})(::typeof(Base.Broadcast.broadcasted), ::ComposedFunction{typeof(exp), typeof(log)}, ::Vector{Int64})
@ Diffractor ~/julia/packages/Diffractor/src/stage1/generated.jl:0
[22] (::∂⃖{1})(::typeof(Base.Broadcast.broadcasted), ::Function, ::Vararg{Any})
@ Diffractor ~/julia/packages/Diffractor/src/stage1/generated.jl:209
[23] #3
@ ./REPL[2]:1 [inlined]
[24] (::Diffractor.∂⃖recurse{1})(::var"#3#4", ::Vector{Int64})
@ Diffractor ~/julia/packages/Diffractor/src/stage1/generated.jl:0
[25] ∂⃖
@ ~/julia/packages/Diffractor/src/stage1/generated.jl:209 [inlined]
[26] ∂⃖
@ ~/julia/packages/Diffractor/src/interface.jl:25 [inlined]
[27] (::Diffractor.∇{var"#3#4"})(args::Vector{Int64})
@ Diffractor ~/julia/packages/Diffractor/src/interface.jl:123
[28] Diffractor.∇(::Function, ::Vector{Int64})
@ Diffractor ~/julia/packages/Diffractor/src/interface.jl:130
[29] top-level scope
@ REPL[2]:1
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #129 +/- ##
==========================================
+ Coverage 48.06% 48.51% +0.45%
==========================================
Files 27 27
Lines 2657 2659 +2
==========================================
+ Hits 1277 1290 +13
+ Misses 1380 1369 -11
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
It looks like we no longer need the hack..