Skip to content

Commit 02fae08

Browse files
authored
Add some missing RNGs (#1373)
1 parent 60563a6 commit 02fae08

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/inference/hmc.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,21 @@ function AbstractMCMC.sample_init!(
126126
if init_theta !== nothing
127127
# Doesn't support dynamic models
128128
link!(spl.state.vi, spl)
129-
model(spl.state.vi, spl)
129+
model(rng, spl.state.vi, spl)
130130
theta = spl.state.vi[spl]
131131
update_hamiltonian!(spl, model, length(theta))
132132
# Refresh the internal cache phase point z's hamiltonian energy.
133133
spl.state.z = AHMC.phasepoint(rng, theta, spl.state.h)
134134
else
135135
# Samples new values and sets trans to true, then computes the logp
136-
model(empty!(spl.state.vi), SampleFromUniform())
136+
model(rng, empty!(spl.state.vi), SampleFromUniform())
137137
link!(spl.state.vi, spl)
138138
theta = spl.state.vi[spl]
139139
update_hamiltonian!(spl, model, length(theta))
140140
# Refresh the internal cache phase point z's hamiltonian energy.
141141
spl.state.z = AHMC.phasepoint(rng, theta, spl.state.h)
142142
while !isfinite(spl.state.z.ℓπ.value) || !isfinite(spl.state.z.ℓπ.gradient)
143-
model(empty!(spl.state.vi), SampleFromUniform())
143+
model(rng, empty!(spl.state.vi), SampleFromUniform())
144144
link!(spl.state.vi, spl)
145145
theta = spl.state.vi[spl]
146146
update_hamiltonian!(spl, model, length(theta))
@@ -171,10 +171,10 @@ function AbstractMCMC.sample_init!(
171171
# non-Gibbs sampling.
172172
if !islinked(spl.state.vi, spl) && spl.selector.tag == :default
173173
link!(spl.state.vi, spl)
174-
model(spl.state.vi, spl)
174+
model(rng, spl.state.vi, spl)
175175
elseif islinked(spl.state.vi, spl) && spl.selector.tag != :default
176176
invlink!(spl.state.vi, spl)
177-
model(spl.state.vi, spl)
177+
model(rng, spl.state.vi, spl)
178178
end
179179
end
180180

@@ -417,7 +417,7 @@ function AbstractMCMC.step!(
417417
# Transform the space
418418
@debug "X-> R..."
419419
link!(spl.state.vi, spl)
420-
model(spl.state.vi, spl)
420+
model(rng, spl.state.vi, spl)
421421
end
422422
# Get position and log density before transition
423423
θ_old, log_density_old = spl.state.vi[spl], getlogp(spl.state.vi)

0 commit comments

Comments
 (0)