Skip to content

Commit 9cbfc7e

Browse files
committed
fix VAIMAcc in gibbs/MH
1 parent 353c2f9 commit 9cbfc7e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/mcmc/gibbs.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,12 @@ function setparams_varinfo!!(
464464
model::DynamicPPL.Model, ::MH, state::AbstractVarInfo, params::AbstractVarInfo
465465
)
466466
# Setting `params` into `state` really just means using `params` itself, but we
467-
# need to update the logprob.
467+
# need to update the logprob. We also need to be a bit more careful, because
468+
# the `state` here carries a VAIMAcc, which is needed for the MH step() function
469+
# but may not be present in `params`. So we need to make sure that the value
470+
# we return from this function also has a VAIMAcc which corresponds to the
471+
# values in `params`.
472+
params = DynamicPPL.setacc!!(params, DynamicPPL.ValuesAsInModelAccumulator(false))
468473
return last(DynamicPPL.evaluate!!(model, params))
469474
end
470475

0 commit comments

Comments
 (0)