Skip to content

Commit 739eb97

Browse files
committed
Fix loop in ADCheck tests
1 parent f2135c4 commit 739eb97

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/ad.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,18 @@ end
214214
@testset verbose = true "AD / ADTypeCheckContext" begin
215215
# This testset ensures that samplers or optimisers don't accidentally
216216
# override the AD backend set in it.
217-
@testset "Check ADType" begin
218-
seed = 123
219-
alg = HMC(0.1, 10; adtype=adtype)
220-
m = DynamicPPL.contextualize(
221-
gdemo_default, ADTypeCheckContext(adtype, gdemo_default.context)
222-
)
223-
# These will error if the adbackend being used is not the one set.
224-
sample(StableRNG(seed), m, alg, 10)
225-
maximum_likelihood(m; adtype=adbackend)
226-
maximum_a_posteriori(m; adtype=adbackend)
217+
@testset "adtype=$adtype" for adtype in ADTYPES
218+
@testset "Check ADType" begin
219+
seed = 123
220+
alg = HMC(0.1, 10; adtype=adtype)
221+
m = DynamicPPL.contextualize(
222+
gdemo_default, ADTypeCheckContext(adtype, gdemo_default.context)
223+
)
224+
# These will error if the adbackend being used is not the one set.
225+
sample(StableRNG(seed), m, alg, 10)
226+
maximum_likelihood(m; adtype=adtype)
227+
maximum_a_posteriori(m; adtype=adtype)
228+
end
227229
end
228230
end
229231

0 commit comments

Comments
 (0)