Skip to content

Commit 71a8cf2

Browse files
committed
Add SamplingContext
1 parent 17a1f00 commit 71a8cf2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/mcmc/abstractmcmc.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ function AbstractMCMC.sample(
282282
initial_params = get(kwargs, :initial_params, nothing)
283283
link = requires_unconstrained_space(spl)
284284
vi = initialise_varinfo(rng, model, spl, initial_params, link)
285-
ldf = LogDensityFunction(model, vi; adtype=get_adtype(spl))
285+
ctx = SamplingContext(rng, spl)
286+
ldf = LogDensityFunction(model, vi, ctx; adtype=get_adtype(spl))
286287
# No need to run check_model again
287288
return AbstractMCMC.sample(rng, ldf, spl, N; kwargs..., check_model=false)
288289
end
@@ -380,7 +381,8 @@ function AbstractMCMC.sample(
380381
initial_params = get(kwargs, :initial_params, nothing)
381382
link = requires_unconstrained_space(spl)
382383
vi = initialise_varinfo(rng, model, spl, initial_params, link)
383-
ldf = LogDensityFunction(model, vi; adtype=get_adtype(spl))
384+
ctx = SamplingContext(rng, spl)
385+
ldf = LogDensityFunction(model, vi, ctx; adtype=get_adtype(spl))
384386
# No need to run check_model again
385387
return AbstractMCMC.sample(
386388
rng, ldf, spl, ensemble, N, n_chains; kwargs..., check_model=false

0 commit comments

Comments
 (0)