File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 6464 @testset " $(model. f) " for model in DynamicPPL. TestUtils. DEMO_MODELS
6565 # Use debug logging below.
6666 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
7068 f_eval, argtypes_eval = DynamicPPL. DebugUtils. gen_evaluator_call_with_types (
7169 model, varinfo
7270 )
7674 model, varinfo, DynamicPPL. SamplingContext ()
7775 )
7876 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
7992 end
8093 end
8194end
You can’t perform that action at this time.
0 commit comments