Skip to content

Commit fa90d1c

Browse files
committed
Globally rename sample!! -> evaluate_and_sample!!, add changelog warning
1 parent d8019e1 commit fa90d1c

14 files changed

+55
-47
lines changed

HISTORY.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ To aid with this process, `contextualize` is now exported from DynamicPPL.
3535

3636
The main situation where one _did_ want to specify an additional evaluation context was when that context was a `SamplingContext`.
3737
Doing this would allow you to run the model and sample fresh values, instead of just using the values that existed in the VarInfo object.
38-
Thus, this release also introduces the unexported function `sample!!`.
39-
Essentially, `sample!!(rng, model, varinfo, sampler)` is a drop-in replacement for `evaluate!!(model, varinfo, SamplingContext(rng, sampler))`.
38+
Thus, this release also introduces the **unexported** function `evaluate_and_sample!!`.
39+
Essentially, `evaluate_and_sample!!(rng, model, varinfo, sampler)` is a drop-in replacement for `evaluate!!(model, varinfo, SamplingContext(rng, sampler))`.
40+
**Do note that this is an internal method**, and its name or semantics are liable to change in the future without warning.
4041

4142
There are many methods that no longer take a context argument, and listing them all would be too much.
4243
However, here are the more user-facing ones:
@@ -50,7 +51,7 @@ However, here are the more user-facing ones:
5051
And a couple of more internal changes:
5152

5253
- `evaluate!!`, `evaluate_threadsafe!!`, and `evaluate_threadunsafe!!` no longer accept context arguments
53-
- `evaluate!!` no longer takes rng and sampler (if you used this, you should use `sample!!` instead, or construct your own `SamplingContext`)
54+
- `evaluate!!` no longer takes rng and sampler (if you used this, you should use `evaluate_and_sample!!` instead, or construct your own `SamplingContext`)
5455
- The model evaluation function, `model.f` for some `model::Model`, no longer takes a context as an argument
5556

5657
## 0.36.12

docs/src/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ By default, it does not perform any actual sampling: it only evaluates the model
455455
To perform sampling, you can either wrap `model.context` in a `SamplingContext`, or use this convenience method:
456456

457457
```@docs
458-
DynamicPPL.sample!!
458+
DynamicPPL.evaluate_and_sample!!
459459
```
460460

461461
The behaviour of a model execution can be changed with evaluation contexts, which are a field of the model.

ext/DynamicPPLMCMCChainsExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function DynamicPPL.predict(
115115
iters = Iterators.product(1:size(chain, 1), 1:size(chain, 3))
116116
predictive_samples = map(iters) do (sample_idx, chain_idx)
117117
DynamicPPL.setval_and_resample!(varinfo, parameter_only_chain, sample_idx, chain_idx)
118-
varinfo = last(DynamicPPL.sample!!(rng, model, varinfo))
118+
varinfo = last(DynamicPPL.evaluate_and_sample!!(rng, model, varinfo))
119119

120120
vals = DynamicPPL.values_as_in_model(model, false, varinfo)
121121
varname_vals = mapreduce(

src/extract_priors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function extract_priors(rng::Random.AbstractRNG, model::Model)
116116
# workaround for the fact that `order` is still hardcoded in VarInfo, and hence you
117117
# can't push new variables without knowing the num_produce. Remove this when possible.
118118
varinfo = setaccs!!(varinfo, (PriorDistributionAccumulator(), NumProduceAccumulator()))
119-
varinfo = last(sample!!(rng, model, varinfo))
119+
varinfo = last(evaluate_and_sample!!(rng, model, varinfo))
120120
return getacc(varinfo, Val(:PriorDistributionAccumulator)).priors
121121
end
122122

src/model.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ end
815815
# ^ Weird Documenter.jl bug means that we have to write the two above separately
816816
# as it can only detect the `function`-less syntax.
817817
function (model::Model)(rng::Random.AbstractRNG, varinfo::AbstractVarInfo=VarInfo())
818-
return first(sample!!(rng, model, varinfo))
818+
return first(evaluate_and_sample!!(rng, model, varinfo))
819819
end
820820

821821
"""
@@ -829,7 +829,7 @@ function use_threadsafe_eval(context::AbstractContext, varinfo::AbstractVarInfo)
829829
end
830830

831831
"""
832-
sample!!([rng::Random.AbstractRNG, ]model::Model, varinfo[, sampler])
832+
evaluate_and_sample!!([rng::Random.AbstractRNG, ]model::Model, varinfo[, sampler])
833833
834834
Evaluate the `model` with the given `varinfo`, but perform sampling during the
835835
evaluation using the given `sampler` by wrapping the model's context in a
@@ -839,7 +839,7 @@ If `sampler` is not provided, defaults to [`SampleFromPrior`](@ref).
839839
840840
Returns a tuple of the model's return value, plus the updated `varinfo` object.
841841
"""
842-
function sample!!(
842+
function evaluate_and_sample!!(
843843
rng::Random.AbstractRNG,
844844
model::Model,
845845
varinfo::AbstractVarInfo,
@@ -848,10 +848,10 @@ function sample!!(
848848
sampling_model = contextualize(model, SamplingContext(rng, sampler, model.context))
849849
return evaluate!!(sampling_model, varinfo)
850850
end
851-
function sample!!(
851+
function evaluate_and_sample!!(
852852
model::Model, varinfo::AbstractVarInfo, sampler::AbstractSampler=SampleFromPrior()
853853
)
854-
return sample!!(Random.default_rng(), model, varinfo, sampler)
854+
return evaluate_and_sample!!(Random.default_rng(), model, varinfo, sampler)
855855
end
856856

857857
"""
@@ -1038,7 +1038,7 @@ Base.nameof(model::Model{<:Function}) = nameof(model.f)
10381038
Generate a sample of type `T` from the prior distribution of the `model`.
10391039
"""
10401040
function Base.rand(rng::Random.AbstractRNG, ::Type{T}, model::Model) where {T}
1041-
x = last(sample!!(rng, model, SimpleVarInfo{Float64}(OrderedDict())))
1041+
x = last(evaluate_and_sample!!(rng, model, SimpleVarInfo{Float64}(OrderedDict())))
10421042
return values_as(x, T)
10431043
end
10441044

src/sampler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function AbstractMCMC.step(
5858
kwargs...,
5959
)
6060
vi = VarInfo()
61-
DynamicPPL.sample!!(rng, model, vi, sampler)
61+
DynamicPPL.evaluate_and_sample!!(rng, model, vi, sampler)
6262
return vi, nothing
6363
end
6464

src/simple_varinfo.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ julia> rng = StableRNG(42);
3939
julia> # In the `NamedTuple` version we need to provide the place-holder values for
4040
# the variables which are using "containers", e.g. `Array`.
4141
# In this case, this means that we need to specify `x` but not `m`.
42-
_, vi = DynamicPPL.sample!!(rng, m, SimpleVarInfo((x = ones(2), )));
42+
_, vi = DynamicPPL.evaluate_and_sample!!(rng, m, SimpleVarInfo((x = ones(2), )));
4343
4444
julia> # (✓) Vroom, vroom! FAST!!!
4545
vi[@varname(x[1])]
@@ -57,12 +57,12 @@ julia> vi[@varname(x[1:2])]
5757
1.3736306979834252
5858
5959
julia> # (×) If we don't provide the container...
60-
_, vi = DynamicPPL.sample!!(rng, m, SimpleVarInfo()); vi
60+
_, vi = DynamicPPL.evaluate_and_sample!!(rng, m, SimpleVarInfo()); vi
6161
ERROR: type NamedTuple has no field x
6262
[...]
6363
6464
julia> # If one does not know the varnames, we can use a `OrderedDict` instead.
65-
_, vi = DynamicPPL.sample!!(rng, m, SimpleVarInfo{Float64}(OrderedDict()));
65+
_, vi = DynamicPPL.evaluate_and_sample!!(rng, m, SimpleVarInfo{Float64}(OrderedDict()));
6666
6767
julia> # (✓) Sort of fast, but only possible at runtime.
6868
vi[@varname(x[1])]
@@ -91,28 +91,28 @@ demo_constrained (generic function with 2 methods)
9191
9292
julia> m = demo_constrained();
9393
94-
julia> _, vi = DynamicPPL.sample!!(rng, m, SimpleVarInfo());
94+
julia> _, vi = DynamicPPL.evaluate_and_sample!!(rng, m, SimpleVarInfo());
9595
9696
julia> vi[@varname(x)] # (✓) 0 ≤ x < ∞
9797
1.8632965762164932
9898
99-
julia> _, vi = DynamicPPL.sample!!(rng, m, DynamicPPL.settrans!!(SimpleVarInfo(), true));
99+
julia> _, vi = DynamicPPL.evaluate_and_sample!!(rng, m, DynamicPPL.settrans!!(SimpleVarInfo(), true));
100100
101101
julia> vi[@varname(x)] # (✓) -∞ < x < ∞
102102
-0.21080155351918753
103103
104-
julia> xs = [last(DynamicPPL.sample!!(rng, m, DynamicPPL.settrans!!(SimpleVarInfo(), true)))[@varname(x)] for i = 1:10];
104+
julia> xs = [last(DynamicPPL.evaluate_and_sample!!(rng, m, DynamicPPL.settrans!!(SimpleVarInfo(), true)))[@varname(x)] for i = 1:10];
105105
106106
julia> any(xs .< 0) # (✓) Positive probability mass on negative numbers!
107107
true
108108
109109
julia> # And with `OrderedDict` of course!
110-
_, vi = DynamicPPL.sample!!(rng, m, DynamicPPL.settrans!!(SimpleVarInfo(OrderedDict()), true));
110+
_, vi = DynamicPPL.evaluate_and_sample!!(rng, m, DynamicPPL.settrans!!(SimpleVarInfo(OrderedDict()), true));
111111
112112
julia> vi[@varname(x)] # (✓) -∞ < x < ∞
113113
0.6225185067787314
114114
115-
julia> xs = [last(DynamicPPL.sample!!(rng, m, DynamicPPL.settrans!!(SimpleVarInfo(), true)))[@varname(x)] for i = 1:10];
115+
julia> xs = [last(DynamicPPL.evaluate_and_sample!!(rng, m, DynamicPPL.settrans!!(SimpleVarInfo(), true)))[@varname(x)] for i = 1:10];
116116
117117
julia> any(xs .< 0) # (✓) Positive probability mass on negative numbers!
118118
true
@@ -259,12 +259,12 @@ end
259259

260260
function untyped_simple_varinfo(model::Model)
261261
varinfo = SimpleVarInfo(OrderedDict())
262-
return last(sample!!(model, varinfo))
262+
return last(evaluate_and_sample!!(model, varinfo))
263263
end
264264

265265
function typed_simple_varinfo(model::Model)
266266
varinfo = SimpleVarInfo{Float64}()
267-
return last(sample!!(model, varinfo))
267+
return last(evaluate_and_sample!!(model, varinfo))
268268
end
269269

270270
function unflatten(svi::SimpleVarInfo, x::AbstractVector)

src/test_utils/model_interface.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ Even though it is recommended to implement this by hand for a particular `Model`
9292
a default implementation using [`SimpleVarInfo{<:Dict}`](@ref) is provided.
9393
"""
9494
function varnames(model::Model)
95-
return collect(keys(last(DynamicPPL.sample!!(model, SimpleVarInfo(Dict())))))
95+
return collect(
96+
keys(last(DynamicPPL.evaluate_and_sample!!(model, SimpleVarInfo(Dict()))))
97+
)
9698
end
9799

98100
"""

src/varinfo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Construct a VarInfo object for the given `model`, which has just a single
197197
function untyped_varinfo(
198198
rng::Random.AbstractRNG, model::Model, sampler::AbstractSampler=SampleFromPrior()
199199
)
200-
return last(sample!!(rng, model, VarInfo(Metadata()), sampler))
200+
return last(evaluate_and_sample!!(rng, model, VarInfo(Metadata()), sampler))
201201
end
202202
function untyped_varinfo(model::Model, sampler::AbstractSampler=SampleFromPrior())
203203
return untyped_varinfo(Random.default_rng(), model, sampler)

test/compiler.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,13 +598,13 @@ module Issue537 end
598598
# an attempt at a `NamedTuple` of the form `(x = 1, __varinfo__)`.
599599
@model empty_model() = return x = 1
600600
empty_vi = VarInfo()
601-
retval_and_vi = DynamicPPL.sample!!(empty_model(), empty_vi)
601+
retval_and_vi = DynamicPPL.evaluate_and_sample!!(empty_model(), empty_vi)
602602
@test retval_and_vi isa Tuple{Int,typeof(empty_vi)}
603603

604604
# Even if the return-value is `AbstractVarInfo`, we should return
605605
# a `Tuple` with `AbstractVarInfo` in the second component too.
606606
@model demo() = return __varinfo__
607-
retval, svi = DynamicPPL.sample!!(demo(), SimpleVarInfo())
607+
retval, svi = DynamicPPL.evaluate_and_sample!!(demo(), SimpleVarInfo())
608608
@test svi == SimpleVarInfo()
609609
if Threads.nthreads() > 1
610610
@test retval isa DynamicPPL.ThreadSafeVarInfo{<:SimpleVarInfo}
@@ -620,11 +620,11 @@ module Issue537 end
620620
f(x) = return x^2
621621
return f(1.0)
622622
end
623-
retval, svi = DynamicPPL.sample!!(demo(), SimpleVarInfo())
623+
retval, svi = DynamicPPL.evaluate_and_sample!!(demo(), SimpleVarInfo())
624624
@test retval isa Float64
625625

626626
@model demo() = x ~ Normal()
627-
retval, svi = DynamicPPL.sample!!(demo(), SimpleVarInfo())
627+
retval, svi = DynamicPPL.evaluate_and_sample!!(demo(), SimpleVarInfo())
628628

629629
# Return-value when using `to_submodel`
630630
@model inner() = x ~ Normal()

test/model.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ const GDEMO_DEFAULT = DynamicPPL.TestUtils.demo_assume_observe_literal()
162162
for i in 1:10
163163
Random.seed!(100 + i)
164164
vi = VarInfo()
165-
DynamicPPL.sample!!(Random.default_rng(), model, vi, sampler)
165+
DynamicPPL.evaluate_and_sample!!(Random.default_rng(), model, vi, sampler)
166166
vals = vi[:]
167167

168168
Random.seed!(100 + i)
169169
vi = VarInfo()
170-
DynamicPPL.sample!!(Random.default_rng(), model, vi, sampler)
170+
DynamicPPL.evaluate_and_sample!!(Random.default_rng(), model, vi, sampler)
171171
@test vi[:] == vals
172172
end
173173
end
@@ -332,7 +332,7 @@ const GDEMO_DEFAULT = DynamicPPL.TestUtils.demo_assume_observe_literal()
332332
@test logjoint(model, x) !=
333333
DynamicPPL.TestUtils.logjoint_true_with_logabsdet_jacobian(model, x...)
334334
# Ensure `varnames` is implemented.
335-
vi = last(DynamicPPL.sample!!(model, SimpleVarInfo(OrderedDict())))
335+
vi = last(DynamicPPL.evaluate_and_sample!!(model, SimpleVarInfo(OrderedDict())))
336336
@test all(collect(keys(vi)) .== DynamicPPL.TestUtils.varnames(model))
337337
# Ensure `posterior_mean` is implemented.
338338
@test DynamicPPL.TestUtils.posterior_mean(model) isa typeof(x)
@@ -591,7 +591,10 @@ const GDEMO_DEFAULT = DynamicPPL.TestUtils.demo_assume_observe_literal()
591591
xs_train = 1:0.1:10
592592
ys_train = ground_truth_β .* xs_train + rand(Normal(0, 0.1), length(xs_train))
593593
m_lin_reg = linear_reg(xs_train, ys_train)
594-
chain = [last(DynamicPPL.sample!!(m_lin_reg, VarInfo())) for _ in 1:10000]
594+
chain = [
595+
last(DynamicPPL.evaluate_and_sample!!(m_lin_reg, VarInfo())) for
596+
_ in 1:10000
597+
]
595598

596599
# chain is generated from the prior
597600
@test mean([chain[i][@varname(β)] for i in eachindex(chain)]) 1.0 atol = 0.1

test/simple_varinfo.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158

159159
### Sampling ###
160160
# Sample a new varinfo!
161-
_, svi_new = DynamicPPL.sample!!(model, svi)
161+
_, svi_new = DynamicPPL.evaluate_and_sample!!(model, svi)
162162

163163
# Realization for `m` should be different wp. 1.
164164
for vn in DynamicPPL.TestUtils.varnames(model)
@@ -226,9 +226,9 @@
226226

227227
# Initialize.
228228
svi_nt = DynamicPPL.settrans!!(SimpleVarInfo(), true)
229-
svi_nt = last(DynamicPPL.sample!!(model, svi_nt))
229+
svi_nt = last(DynamicPPL.evaluate_and_sample!!(model, svi_nt))
230230
svi_vnv = DynamicPPL.settrans!!(SimpleVarInfo(DynamicPPL.VarNamedVector()), true)
231-
svi_vnv = last(DynamicPPL.sample!!(model, svi_vnv))
231+
svi_vnv = last(DynamicPPL.evaluate_and_sample!!(model, svi_vnv))
232232

233233
for svi in (svi_nt, svi_vnv)
234234
# Sample with large variations in unconstrained space.
@@ -273,7 +273,7 @@
273273
)
274274

275275
# Resulting varinfo should no longer be transformed.
276-
vi_result = last(DynamicPPL.sample!!(model, deepcopy(vi)))
276+
vi_result = last(DynamicPPL.evaluate_and_sample!!(model, deepcopy(vi)))
277277
@test !DynamicPPL.istrans(vi_result)
278278

279279
# Set the values to something that is out of domain if we're in constrained space.

test/varinfo.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ end
498498
# without having to change the VarInfo object.
499499
vi = VarInfo()
500500
meta = vi.metadata
501-
_, vi = DynamicPPL.sample!!(model, vi, SampleFromUniform())
501+
_, vi = DynamicPPL.evaluate_and_sample!!(model, vi, SampleFromUniform())
502502
@test all(x -> !istrans(vi, x), meta.vns)
503503

504504
# Check that linking and invlinking set the `trans` flag accordingly
@@ -572,7 +572,7 @@ end
572572
vi = DynamicPPL.untyped_varinfo(model)
573573
vi = DynamicPPL.settrans!!(vi, true, vn)
574574
# Sample in unconstrained space.
575-
vi = last(DynamicPPL.sample!!(model, vi))
575+
vi = last(DynamicPPL.evaluate_and_sample!!(model, vi))
576576
f = DynamicPPL.from_linked_internal_transform(vi, vn, dist)
577577
x = f(DynamicPPL.getindex_internal(vi, vn))
578578
@test getlogjoint(vi) Bijectors.logpdf_with_trans(dist, x, true)
@@ -581,7 +581,7 @@ end
581581
vi = DynamicPPL.typed_varinfo(model)
582582
vi = DynamicPPL.settrans!!(vi, true, vn)
583583
# Sample in unconstrained space.
584-
vi = last(DynamicPPL.sample!!(model, vi))
584+
vi = last(DynamicPPL.evaluate_and_sample!!(model, vi))
585585
f = DynamicPPL.from_linked_internal_transform(vi, vn, dist)
586586
x = f(DynamicPPL.getindex_internal(vi, vn))
587587
@test getlogjoint(vi) Bijectors.logpdf_with_trans(dist, x, true)
@@ -590,7 +590,7 @@ end
590590
vi = DynamicPPL.typed_varinfo(model)
591591
vi = DynamicPPL.settrans!!(vi, true, vn)
592592
# Sample in unconstrained space.
593-
vi = last(DynamicPPL.sample!!(model, vi))
593+
vi = last(DynamicPPL.evaluate_and_sample!!(model, vi))
594594
f = DynamicPPL.from_linked_internal_transform(vi, vn, dist)
595595
x = f(DynamicPPL.getindex_internal(vi, vn))
596596
@test getlogjoint(vi) Bijectors.logpdf_with_trans(dist, x, true)
@@ -599,23 +599,23 @@ end
599599
## `SimpleVarInfo{<:NamedTuple}`
600600
vi = DynamicPPL.settrans!!(SimpleVarInfo(), true)
601601
# Sample in unconstrained space.
602-
vi = last(DynamicPPL.sample!!(model, vi))
602+
vi = last(DynamicPPL.evaluate_and_sample!!(model, vi))
603603
f = DynamicPPL.from_linked_internal_transform(vi, vn, dist)
604604
x = f(DynamicPPL.getindex_internal(vi, vn))
605605
@test getlogjoint(vi) Bijectors.logpdf_with_trans(dist, x, true)
606606

607607
## `SimpleVarInfo{<:Dict}`
608608
vi = DynamicPPL.settrans!!(SimpleVarInfo(Dict()), true)
609609
# Sample in unconstrained space.
610-
vi = last(DynamicPPL.sample!!(model, vi))
610+
vi = last(DynamicPPL.evaluate_and_sample!!(model, vi))
611611
f = DynamicPPL.from_linked_internal_transform(vi, vn, dist)
612612
x = f(DynamicPPL.getindex_internal(vi, vn))
613613
@test getlogjoint(vi) Bijectors.logpdf_with_trans(dist, x, true)
614614

615615
## `SimpleVarInfo{<:VarNamedVector}`
616616
vi = DynamicPPL.settrans!!(SimpleVarInfo(DynamicPPL.VarNamedVector()), true)
617617
# Sample in unconstrained space.
618-
vi = last(DynamicPPL.sample!!(model, vi))
618+
vi = last(DynamicPPL.evaluate_and_sample!!(model, vi))
619619
f = DynamicPPL.from_linked_internal_transform(vi, vn, dist)
620620
x = f(DynamicPPL.getindex_internal(vi, vn))
621621
@test getlogjoint(vi) Bijectors.logpdf_with_trans(dist, x, true)
@@ -1000,7 +1000,7 @@ end
10001000
# Sampling from `model2` should hit the `istrans(vi) == true` branches
10011001
# because all the existing variables are linked.
10021002
model2 = demo(2)
1003-
varinfo2 = last(DynamicPPL.sample!!(model2, deepcopy(varinfo1)))
1003+
varinfo2 = last(DynamicPPL.evaluate_and_sample!!(model2, deepcopy(varinfo1)))
10041004
for vn in [@varname(x[1]), @varname(x[2])]
10051005
@test DynamicPPL.istrans(varinfo2, vn)
10061006
end
@@ -1019,7 +1019,7 @@ end
10191019
# Sampling from `model2` should hit the `istrans(vi) == true` branches
10201020
# because all the existing variables are linked.
10211021
model2 = demo_dot(2)
1022-
varinfo2 = last(DynamicPPL.sample!!(model2, deepcopy(varinfo1)))
1022+
varinfo2 = last(DynamicPPL.evaluate_and_sample!!(model2, deepcopy(varinfo1)))
10231023
for vn in [@varname(x), @varname(y[1])]
10241024
@test DynamicPPL.istrans(varinfo2, vn)
10251025
end

test/varnamedvector.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,9 @@ end
610610
DynamicPPL.TestUtils.test_values(varinfo_eval, value_true, vns)
611611

612612
# Is sampling correct?
613-
varinfo_sample = last(DynamicPPL.sample!!(model, deepcopy(varinfo)))
613+
varinfo_sample = last(
614+
DynamicPPL.evaluate_and_sample!!(model, deepcopy(varinfo))
615+
)
614616
# Log density should be different.
615617
@test getlogjoint(varinfo_sample) != getlogjoint(varinfo)
616618
# Values should be different.

0 commit comments

Comments
 (0)