Skip to content

Commit 195f819

Browse files
committed
fix run_ad
1 parent c912fb9 commit 195f819

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/ad.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,10 @@ end
256256

257257
@testset "model=$(model.f)" for model in DEMO_MODELS
258258
rng = StableRNG(123)
259-
ctx = DynamicPPL.SamplingContext(rng, DynamicPPL.Sampler(alg))
260-
@test run_ad(model, adtype; context=ctx, test=true, benchmark=false) isa Any
259+
spl_model = DynamicPPL.contextualize(
260+
model, DynamicPPL.SamplingContext(rng, DynamicPPL.Sampler(alg))
261+
)
262+
@test run_ad(spl_model, adtype; test=true, benchmark=false) isa Any
261263
end
262264
end
263265
end
@@ -283,8 +285,10 @@ end
283285
model, varnames, deepcopy(global_vi)
284286
)
285287
rng = StableRNG(123)
286-
ctx = DynamicPPL.SamplingContext(rng, DynamicPPL.Sampler(HMC(0.1, 10)))
287-
@test run_ad(model, adtype; context=ctx, test=true, benchmark=false) isa Any
288+
spl_model = DynamicPPL.contextualize(
289+
model, DynamicPPL.SamplingContext(rng, DynamicPPL.Sampler(HMC(0.1, 10)))
290+
)
291+
@test run_ad(spl_model, adtype; test=true, benchmark=false) isa Any
288292
end
289293
end
290294
end

0 commit comments

Comments
 (0)