diff --git a/Project.toml b/Project.toml index b015dec7d1..c3285fc41b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Turing" uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" -version = "0.36.1" +version = "0.36.2" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" @@ -63,7 +63,7 @@ Distributions = "0.23.3, 0.24, 0.25" DistributionsAD = "0.6" DocStringExtensions = "0.8, 0.9" DynamicHMC = "3.4" -DynamicPPL = "0.33, 0.34" +DynamicPPL = "0.34.1" EllipticalSliceSampling = "0.5, 1, 2" ForwardDiff = "0.10.3" Libtask = "0.8.8" diff --git a/test/mcmc/gibbs.jl b/test/mcmc/gibbs.jl index 1d7208b43d..cd5d05a6bd 100644 --- a/test/mcmc/gibbs.jl +++ b/test/mcmc/gibbs.jl @@ -759,6 +759,26 @@ end check_numerical(chain, [:m1, :m2], [-0.2, 0.6]; atol=0.1) end end + + # Test a model that where the sampler needs to link a variable, which consequently + # changes dimension. This used to error because the initial value `VarInfo`, + # obtained from just `VarInfo(model)`, had a value of dimension 2 for `w`, and the one + # coming out of the initial step of the component sampler had a dimension of 1, since + # the latter was linked. `merge` of the varinfos couldn't handle that before DPPL + # 0.34.1. + @testset "linking changes dimension" begin + @model function dirichlet_model() + K = 2 + w ~ Dirichlet(K, 1.0) + for i in 1:K + 0.1 ~ Normal(w[i], 1.0) + end + end + + model = dirichlet_model() + sampler = Gibbs(:w => HMC(0.05, 10)) + @test (sample(model, sampler, 10); true) + end end end