We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
values_as_in_model(rng, model, ...)
1 parent edbfe3a commit dea62bbCopy full SHA for dea62bb
test/model.jl
@@ -396,6 +396,22 @@ const GDEMO_DEFAULT = DynamicPPL.TestUtils.demo_assume_observe_literal()
396
end
397
398
399
+
400
+ @testset "check that sampling obeys rng if passed" begin
401
+ @model function f()
402
+ x ~ Normal(0)
403
+ return y ~ Normal(x)
404
+ end
405
+ model = f()
406
+ # Call values_as_in_model with the rng
407
+ values = values_as_in_model(Random.Xoshiro(43), model, false)
408
+ # Check that they match the values that would be used if vi was seeded
409
+ # with that seed instead
410
+ expected_vi = VarInfo(Random.Xoshiro(43), model)
411
+ for vn in keys(values)
412
+ @test values[vn] == expected_vi[vn]
413
414
415
416
417
@testset "Erroneous model call" begin
0 commit comments