Closed
Description
Follow-up from #890 (comment);
Right now, assuming that #890 gets merged, linking varinfo
and attempting to use linked=true
in test/ad.jl
throws this error:
[ Info: Testing AD on: demo_dot_assume_observe_index_literal - SimpleVarInfo{<:OrderedDict} - AutoReverseDiff(compile=true)
AutoReverseDiff(compile=true): Error During Test at /home/runner/work/DynamicPPL.jl/DynamicPPL.jl/test/ad.jl:62
Test threw exception
Expression: DynamicPPL.TestUtils.AD.run_ad(m, adtype; test = true, benchmark = true, varinfo = varinfo, expected_value_and_grad = (ref_logp, ref_grad)) isa Any
AssertionError: Trying to link already transformed variables
Stacktrace:
[1] tilde_assume(::DynamicPPL.DynamicTransformationContext{false}, right::InverseGamma{Float64}, vn::VarName{:s, IndexLens{Tuple{Int64}}}, vi::DynamicPPL.ThreadSafeVarInfo{SimpleVarInfo{OrderedDict{Any, Any}, Float64, DynamicPPL.DynamicTransformation}, Vector{Float64}})
@ DynamicPPL ~/work/DynamicPPL.jl/DynamicPPL.jl/src/transforming.jl:22
[2] tilde_assume!!(context::DynamicPPL.DynamicTransformationContext{false}, right::InverseGamma{Float64}, vn::VarName{:s, IndexLens{Tuple{Int64}}}, vi::DynamicPPL.ThreadSafeVarInfo{SimpleVarInfo{OrderedDict{Any, Any}, Float64, DynamicPPL.DynamicTransformation}, Vector{Float64}})
@ DynamicPPL ~/work/DynamicPPL.jl/DynamicPPL.jl/src/context_implementations.jl:114
[3] demo_dot_assume_observe_index_literal(__model__::Model{typeof(DynamicPPL.TestUtils.demo_dot_assume_observe_index_literal), (Symbol("##arg#386"),), (), (), Tuple{DynamicPPL.TypeWrap{Vector{Float64}}}, Tuple{}, DefaultContext}, __varinfo__::DynamicPPL.ThreadSafeVarInfo{SimpleVarInfo{OrderedDict{Any, Any}, Float64, DynamicPPL.DynamicTransformation}, Vector{Float64}}, __context__::DynamicPPL.DynamicTransformationContext{false}, arg#386::DynamicPPL.TypeWrap{Vector{Float64}})
@ DynamicPPL.TestUtils ~/work/DynamicPPL.jl/DynamicPPL.jl/src/test_utils/models.jl:355
[4] _evaluate!!(model::Model{typeof(DynamicPPL.TestUtils.demo_dot_assume_observe_index_literal), (Symbol("##arg#386"),), (), (), Tuple{DynamicPPL.TypeWrap{Vector{Float64}}}, Tuple{}, DefaultContext}, varinfo::DynamicPPL.ThreadSafeVarInfo{SimpleVarInfo{OrderedDict{Any, Any}, Float64, DynamicPPL.DynamicTransformation}, Vector{Float64}}, context::DynamicPPL.DynamicTransformationContext{false})
@ DynamicPPL ~/work/DynamicPPL.jl/DynamicPPL.jl/src/model.jl:912
[5] evaluate_threadsafe!!(model::Model{typeof(DynamicPPL.TestUtils.demo_dot_assume_observe_index_literal), (Symbol("##arg#386"),), (), (), Tuple{DynamicPPL.TypeWrap{Vector{Float64}}}, Tuple{}, DefaultContext}, varinfo::SimpleVarInfo{OrderedDict{Any, Any}, Float64, DynamicPPL.DynamicTransformation}, context::DynamicPPL.DynamicTransformationContext{false})
@ DynamicPPL ~/work/DynamicPPL.jl/DynamicPPL.jl/src/model.jl:901
[6] evaluate!!(model::Model{typeof(DynamicPPL.TestUtils.demo_dot_assume_observe_index_literal), (Symbol("##arg#386"),), (), (), Tuple{DynamicPPL.TypeWrap{Vector{Float64}}}, Tuple{}, DefaultContext}, varinfo::SimpleVarInfo{OrderedDict{Any, Any}, Float64, DynamicPPL.DynamicTransformation}, context::DynamicPPL.DynamicTransformationContext{false})
@ DynamicPPL ~/work/DynamicPPL.jl/DynamicPPL.jl/src/model.jl:831
[7] link!!(t::DynamicPPL.DynamicTransformation, vi::SimpleVarInfo{OrderedDict{Any, Any}, Float64, DynamicPPL.DynamicTransformation}, model::Model{typeof(DynamicPPL.TestUtils.demo_dot_assume_observe_index_literal), (Symbol("##arg#386"),), (), (), Tuple{DynamicPPL.TypeWrap{Vector{Float64}}}, Tuple{}, DefaultContext})
@ DynamicPPL ~/work/DynamicPPL.jl/DynamicPPL.jl/src/transforming.jl:34
I need to figure out DynamicTransformationContext a bit more to understand why this happens and why it's not a warning, hence I'm punting it to a future PR, but opening this issue to keep track.
Metadata
Metadata
Assignees
Labels
No labels