-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add value_iterator_from_chain tests from test/turing/model.jl
- Loading branch information
1 parent
b52aa73
commit 1055a10
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@testset "model_utils.jl" begin | ||
|
||
@testset "value_iterator_from_chain" begin | ||
@testset "$model" for model in DynamicPPL.TestUtils.DEMO_MODELS | ||
chain = make_chain_from_prior(model, 10) | ||
for (i, d) in enumerate(value_iterator_from_chain(model, chain)) | ||
for vn in keys(d) | ||
val = DynamicPPL.getvalue(d, vn) | ||
for vn_leaf in DynamicPPL.varname_leaves(vn, val) | ||
val_leaf = DynamicPPL.getvalue(d, vn_leaf) | ||
@test val_leaf == chain[i, Symbol(vn_leaf), 1] | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
end |