Skip to content

Commit ee37bdf

Browse files
committed
Fix .~
1 parent 819f17b commit ee37bdf

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

developers/compiler/model-manual/index.qmd

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ using Turing
1616
m ~ Normal(0, sqrt(s²))
1717
1818
# Observe each value of x.
19-
@. x ~ Normal(m, sqrt(s²))
19+
x .~ Normal(m, sqrt(s²))
20+
21+
return nothing
2022
end
2123
2224
model = gdemo([1.5, 2.0])
@@ -43,9 +45,15 @@ function gdemo2(model, varinfo, context, x)
4345
)
4446
4547
# Observe each value of x[i] according to a Normal distribution.
46-
return DynamicPPL.dot_tilde_observe!!(
47-
context, Normal(m, sqrt(s²)), x, Turing.@varname(x), varinfo
48-
)
48+
for i in eachindex(x)
49+
_retval, varinfo = DynamicPPL.tilde_observe!!(
50+
context, Normal(m, sqrt(s²)), x[i], Turing.@varname(x[i]), varinfo
51+
)
52+
end
53+
54+
# The final return statement should comprise both the original return
55+
# value and the updated varinfo.
56+
return nothing, varinfo
4957
end
5058
gdemo2(x) = Turing.Model(gdemo2, (; x))
5159

0 commit comments

Comments
 (0)