Skip to content

Commit 42a3ceb

Browse files
committed
Add an explanatory comment
1 parent eff3bd9 commit 42a3ceb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/mcmc/prior.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,19 @@ function AbstractMCMC.step(
3636
vi::AbstractVarInfo;
3737
kwargs...,
3838
)
39-
# TODO(DPPL0.38/penelopeysm): replace the entire thing with init!!
39+
# TODO(DPPL0.38/penelopeysm): replace this entire thing with init!!
40+
#
4041
# `vi` is a VarInfo from the previous step so already has all the
41-
# right accumulators and stuff. The only thing we need to change is
42-
# to make sure that the old values are overwritten...
42+
# right accumulators and stuff. The only thing we need to change is to make
43+
# sure that the old values are overwritten when we resample.
44+
#
45+
# Note also that the values in the Transition (and hence the chain) are not
46+
# obtained from the VarInfo's metadata itself, but are instead obtained
47+
# from the ValuesAsInModelAccumulator, which is cleared in the evaluate!!
48+
# call. Thus, the actual values in the VarInfo's metadata don't matter:
49+
# we only set the del flag here to make sure that new values are sampled
50+
# (and thus new values enter VAIMAcc), rather than the old ones being
51+
# reused during the evaluation. Yes, SampleFromPrior really sucks.
4352
for vn in keys(vi)
4453
DynamicPPL.set_flag!(vi, vn, "del")
4554
end

0 commit comments

Comments
 (0)