|
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 by checking the |
70 |
| - # type inference with a typed varinfo. |
| 67 | + # Check that the inferred varinfo is indeed suitable for evaluation and sampling |
71 | 68 | f_eval, argtypes_eval = DynamicPPL.DebugUtils.gen_evaluator_call_with_types(
|
72 |
| - model, VarInfo(model) |
| 69 | + model, varinfo |
73 | 70 | )
|
74 | 71 | JET.test_call(f_eval, argtypes_eval)
|
75 | 72 |
|
76 | 73 | f_sample, argtypes_sample = DynamicPPL.DebugUtils.gen_evaluator_call_with_types(
|
77 |
| - model, VarInfo(model), DynamicPPL.SamplingContext() |
| 74 | + model, varinfo, DynamicPPL.SamplingContext() |
78 | 75 | )
|
79 | 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 |
80 | 92 | end
|
81 | 93 | end
|
82 | 94 | end
|
0 commit comments