Skip to content

Commit c497b29

Browse files
committed
Fix #129
1 parent 06e7fe0 commit c497b29

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/context_implementations.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function dot_tilde(
177177
else
178178
vns, dist = get_vns_and_dist(right, left, vn)
179179
end
180-
return _dot_tilde(rng, sampler, NoDist(dist), left, vns, vi)
180+
return _dot_tilde(rng, sampler, NoDist.(dist), left, vns, vi)
181181
end
182182
function dot_tilde(rng, ctx::MiniBatchContext, sampler, right, left, vn::VarName, inds, vi)
183183
return dot_tilde(rng, ctx.ctx, sampler, right, left, vn, inds, vi)

test/context_implementations.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@testset "context_implementations.jl" begin
2+
# https://github.com/TuringLang/DynamicPPL.jl/issues/129
3+
@testset "#129" begin
4+
@model function test(x)
5+
μ ~ MvNormal(fill(0, 2), 2.0)
6+
z = Vector{Int}(undef, length(x))
7+
z .~ Categorical.(fill([0.5, 0.5], length(x)))
8+
for i in 1:length(x)
9+
x[i] ~ Normal(μ[z[i]], 0.1)
10+
end
11+
end
12+
13+
test([1, 1, -1])(VarInfo(), SampleFromPrior(), LikelihoodContext())
14+
end
15+
end

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ include("test_util.jl")
2525
include("prob_macro.jl")
2626
include("independence.jl")
2727
include("distribution_wrappers.jl")
28+
include("context_implementations.jl")
2829

2930
include("threadsafe.jl")
3031

0 commit comments

Comments
 (0)