File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -214,20 +214,18 @@ priors = 0 # See "new grammar" test.
214
214
@test varinfo === _varinfo
215
215
end
216
216
@testset " nested model" begin
217
- # function nest(α_0, θ_0)
218
- # @model gdemo(x) = begin
219
- # λ ~ Gamma(α_0, θ_0)
220
- # m ~ Normal(0, √(1 / λ))
221
- # x .~ Normal(m, √(1 / λ))
222
- # global lp = @logpdf()
223
- # end
224
-
225
- # return gdemo
226
- # end
227
- # model = nest(2.0, inv(3.0))([1.5, 2.0])
228
- # varinfo = DynamicPPL.VarInfo(model)
229
- # model(varinfo)
230
- # @test getlogp(varinfo) = lp
217
+ function makemodel (p)
218
+ @model testmodel (x) = begin
219
+ x[1 ] ~ Bernoulli (p)
220
+ global lp = @logpdf ()
221
+ return x
222
+ end
223
+ return testmodel
224
+ end
225
+ model = makemodel (0.5 )([1.0 ])
226
+ varinfo = DynamicPPL. VarInfo (model)
227
+ model (varinfo)
228
+ @test getlogp (varinfo) == lp
231
229
end
232
230
@testset " new grammar" begin
233
231
x = Float64[1 2 ]
You can’t perform that action at this time.
0 commit comments