Skip to content

Commit 2062ed3

Browse files
Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 888cd5f commit 2062ed3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/varinfo.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,33 +276,33 @@
276276
# See https://github.com/TuringLang/DynamicPPL.jl/issues/504
277277
@testset "Dimentionality checks" begin
278278
@model function demo2d()
279-
x ~ Dirichlet(2, 1.0)
279+
return x ~ Dirichlet(2, 1.0)
280280
end
281281
model = demo2d()
282-
vi = VarInfo(model) # make VarInfo -> sample from prior and compute logdensity
282+
vi = VarInfo(model) # make VarInfo -> sample from prior and compute logdensity
283283
getlogp(vi) 0.0 # zero because Dirichlet(1) == Uniform over Simplex
284-
spl = SampleFromPrior() # create dummy sampler for linking
284+
spl = SampleFromPrior() # create dummy sampler for linking
285285
DynamicPPL.link!!(vi, spl, model) # transform to unconstrained space
286286
!(0.0 getlogp(last(DynamicPPL.evaluate!!(model, vi)))) # non-zero now due to log(abs(determinant(jacobian)))
287287
x = vi[spl] # extract unconstrained values
288-
newx = deepcopy(x) # simulate making a change to x
288+
newx = deepcopy(x) # simulate making a change to x
289289
vinew = deepcopy(vi)
290-
vinew[spl] = newx;
290+
vinew[spl] = newx
291291
@test vinew[spl] == newx
292292

293293
@model function demo3d()
294-
x ~ Dirichlet(3, 1.0) # increase K to 3
294+
return x ~ Dirichlet(3, 1.0) # increase K to 3
295295
end
296296
model = demo3d()
297-
vi = VarInfo(model) # make VarInfo -> sample from prior and compute logdensity
297+
vi = VarInfo(model) # make VarInfo -> sample from prior and compute logdensity
298298
getlogp(vi) 0.0 # zero because Dirichlet(1) == Uniform over Simplex
299-
spl = SampleFromPrior() # create dummy sampler for linking
299+
spl = SampleFromPrior() # create dummy sampler for linking
300300
DynamicPPL.link!!(vi, spl, model) # transform to unconstrained space
301301
!(0.0 getlogp(last(DynamicPPL.evaluate!!(model, vi)))) # non-zero now due to log(abs(determinant(jacobian)))
302302
x = vi[spl] # extract unconstrained values
303-
newx = deepcopy(x) # simulate making a change to x
303+
newx = deepcopy(x) # simulate making a change to x
304304
vinew = deepcopy(vi)
305-
vinew[spl] = newx;
305+
vinew[spl] = newx
306306

307307
@test vinew[spl] == newx
308308
end

0 commit comments

Comments
 (0)