File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 64
64
@testset " $(model. f) " for model in DynamicPPL. TestUtils. DEMO_MODELS
65
65
# Use debug logging below.
66
66
varinfo = DynamicPPL. Experimental. determine_suitable_varinfo (model)
67
- # They should all result in typed.
68
- @test varinfo isa DynamicPPL. TypedVarInfo
69
- # But let's also make sure that they're not lying.
67
+ # Check that the inferred varinfo is indeed suitable for evaluation and sampling
70
68
f_eval, argtypes_eval = DynamicPPL. DebugUtils. gen_evaluator_call_with_types (
71
69
model, varinfo
72
70
)
76
74
model, varinfo, DynamicPPL. SamplingContext ()
77
75
)
78
76
JET. test_call (f_sample, argtypes_sample)
77
+ # For our demo models, they should all result in typed.
78
+ is_typed = varinfo isa DynamicPPL. TypedVarInfo
79
+ @test is_typed
80
+ # If the test failed, check why it didn't infer a typed varinfo
81
+ if ! is_typed
82
+ typed_vi = VarInfo (model)
83
+ f_eval, argtypes_eval = DynamicPPL. DebugUtils. gen_evaluator_call_with_types (
84
+ model, typed_vi
85
+ )
86
+ JET. test_call (f_eval, argtypes_eval)
87
+ f_sample, argtypes_sample = DynamicPPL. DebugUtils. gen_evaluator_call_with_types (
88
+ model, typed_vi, DynamicPPL. SamplingContext ()
89
+ )
90
+ JET. test_call (f_sample, argtypes_sample)
91
+ end
79
92
end
80
93
end
81
94
end
You can’t perform that action at this time.
0 commit comments