Skip to content

Commit 0ec0bb6

Browse files
authored
Merge pull request #136 from TuringLang/nodist
Fix #129
2 parents e85f821 + c497b29 commit 0ec0bb6

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicPPL"
22
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
33
authors = ["mohamed82008 <[email protected]>"]
4-
version = "0.8.0"
4+
version = "0.8.1"
55

66
[deps]
77
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

src/context_implementations.jl

Lines changed: 2 additions & 2 deletions
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)
@@ -392,7 +392,7 @@ function dot_tilde(ctx::LikelihoodContext, sampler, right, left, vi)
392392
return _dot_tilde(sampler, right, left, vi)
393393
end
394394
function dot_tilde(ctx::MiniBatchContext, sampler, right, left, vi)
395-
return ctx.loglike_scalar * dot_tilde(ctx.ctx, sampler, right, left, left, vi)
395+
return ctx.loglike_scalar * dot_tilde(ctx.ctx, sampler, right, left, vi)
396396
end
397397

398398
"""

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)