Skip to content

Commit a2d74f5

Browse files
committed
Add infos to dynamicppl/compiler
1 parent ae9370b commit a2d74f5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/dynamicppl/compiler.jl

+23
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ end
1717
const gdemo_default = gdemo_d()
1818

1919
@testset "compiler.jl" begin
20+
@info "compiler.jl"
21+
2022
@testset "assume" begin
23+
@info "assume"
24+
2125
@model function test_assume()
2226
x ~ Bernoulli(1)
2327
y ~ Bernoulli(x / 2)
@@ -37,7 +41,10 @@ const gdemo_default = gdemo_d()
3741
@test all(isone, res1[:x])
3842
@test all(isone, res2[:x])
3943
end
44+
4045
@testset "beta binomial" begin
46+
@info "beta binomial"
47+
4148
prior = Beta(2, 2)
4249
obs = [0, 1, 0, 1, 1, 1, 1, 1, 1, 1]
4350
exact = Beta(prior.α + sum(obs), prior.β + length(obs) - sum(obs))
@@ -64,7 +71,9 @@ const gdemo_default = gdemo_d()
6471
check_numerical(chn_p, [:x], [meanp]; atol=0.1)
6572
check_numerical(chn_g, [:x], [meanp]; atol=0.1)
6673
end
74+
6775
@testset "model with global variables" begin
76+
@info "model with global variables"
6877
xs = [1.5 2.0]
6978
# xx = 1
7079

@@ -84,7 +93,9 @@ const gdemo_default = gdemo_d()
8493
gibbs = Gibbs(:s => PG(10), :m => HMC(0.4, 8))
8594
chain = sample(fggibbstest(xs), gibbs, 2)
8695
end
96+
8797
@testset "new grammar" begin
98+
@info "new grammar"
8899
x = Float64[1 2]
89100

90101
@model function gauss(x)
@@ -121,7 +132,9 @@ const gdemo_default = gdemo_d()
121132
gauss2(DynamicPPL.TypeWrap{Vector{Float64}}(); x=x), SMC(), 10
122133
)
123134
end
135+
124136
@testset "new interface" begin
137+
@info "new interface"
125138
obs = [0, 1, 0, 1, 1, 1, 1, 1, 1, 1]
126139

127140
@model function newinterface(obs)
@@ -138,7 +151,9 @@ const gdemo_default = gdemo_d()
138151
100,
139152
)
140153
end
154+
141155
@testset "no return" begin
156+
@info "no return"
142157
@model function noreturn(x)
143158
s ~ InverseGamma(2, 3)
144159
m ~ Normal(0, sqrt(s))
@@ -150,7 +165,9 @@ const gdemo_default = gdemo_d()
150165
chain = sample(noreturn([1.5 2.0]), HMC(0.15, 6), 1000)
151166
check_numerical(chain, [:s, :m], [49 / 24, 7 / 6])
152167
end
168+
153169
@testset "observe with literals" begin
170+
@info "observe with literals"
154171
@model function test()
155172
z ~ Normal(0, 1)
156173
x ~ Bernoulli(1)
@@ -177,11 +194,13 @@ const gdemo_default = gdemo_d()
177194
end
178195

179196
@testset "sample" begin
197+
@info "sample"
180198
alg = Gibbs(:m => HMC(0.2, 3), :s => PG(10))
181199
chn = sample(gdemo_default, alg, 1000)
182200
end
183201

184202
@testset "vectorization @." begin
203+
@info "vectorization @."
185204
@model function vdemo1(x)
186205
s ~ InverseGamma(2, 3)
187206
m ~ Normal(0, sqrt(s))
@@ -257,7 +276,9 @@ const gdemo_default = gdemo_d()
257276

258277
sample(vdemo7(), alg, 1000)
259278
end
279+
260280
@testset "vectorization .~" begin
281+
@info "vectorization .~"
261282
@model function vdemo1(x)
262283
s ~ InverseGamma(2, 3)
263284
m ~ Normal(0, sqrt(s))
@@ -323,7 +344,9 @@ const gdemo_default = gdemo_d()
323344

324345
sample(vdemo7(), alg, 1000)
325346
end
347+
326348
@testset "Type parameters" begin
349+
@info "Type parameters"
327350
N = 10
328351
alg = HMC(0.01, 5; adtype=AutoForwardDiff(; chunksize=N))
329352
x = randn(1000)

0 commit comments

Comments
 (0)