Skip to content

Commit 7b99643

Browse files
authored
Merge branch 'main' into mooncake-nocache-optimization
2 parents 5c79686 + ce7c8b1 commit 7b99643

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

HISTORY.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# DynamicPPL Changelog
22

3-
## 0.36.15
3+
## 0.36.16
44

55
Improved performance for some models with Mooncake.jl by using `NoCache` with `Mooncake.set_to_zero!!` for DynamicPPL types.
66

7+
## 0.36.15
8+
9+
Bumped minimum Julia version to 1.10.8 to avoid potential crashes with `Core.Compiler.widenconst` (which Mooncake uses).
10+
711
## 0.36.14
812

913
Added compatibility with [email protected].

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DynamicPPL"
22
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
3-
version = "0.36.14"
3+
version = "0.36.15"
44

55
[deps]
66
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -72,4 +72,4 @@ Random = "1.6"
7272
Requires = "1"
7373
Statistics = "1"
7474
Test = "1.6"
75-
julia = "1.10"
75+
julia = "1.10.8"

src/test_utils/models.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ A model with variables `m` and `x` with `x` having support depending on `m`.
1414
"""
1515
@model function demo_dynamic_constraint()
1616
m ~ Normal()
17-
x ~ truncated(Normal(), m, Inf)
17+
x ~ truncated(Normal(); lower=m)
1818

1919
return (m=m, x=x)
2020
end
2121
function logprior_true(model::Model{typeof(demo_dynamic_constraint)}, m, x)
22-
return logpdf(Normal(), m) + logpdf(truncated(Normal(), m, Inf), x)
22+
return logpdf(Normal(), m) + logpdf(truncated(Normal(); lower=m), x)
2323
end
2424
function loglikelihood_true(model::Model{typeof(demo_dynamic_constraint)}, m, x)
2525
return zero(float(eltype(m)))
@@ -30,7 +30,7 @@ end
3030
function logprior_true_with_logabsdet_jacobian(
3131
model::Model{typeof(demo_dynamic_constraint)}, m, x
3232
)
33-
b_x = Bijectors.bijector(truncated(Normal(), m, Inf))
33+
b_x = Bijectors.bijector(truncated(Normal(); lower=m))
3434
x_unconstrained, Δlogp = Bijectors.with_logabsdet_jacobian(b_x, x)
3535
return (m=m, x=x_unconstrained), logprior_true(model, m, x) - Δlogp
3636
end

test/compiler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ module Issue537 end
501501
@model function demo(y)
502502
α ~ Uniform()
503503
μ ~ Normal()
504-
σ ~ truncated(Normal(), 0, Inf)
504+
σ ~ truncated(Normal(); lower=0)
505505
num_steps = length(y[1])
506506
num_obs = length(y)
507507
@inbounds for i in 1:num_obs

test/varinfo.jl

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,8 @@ end
6767

6868
@testset "Base" begin
6969
# Test Base functions:
70-
# string, Symbol, ==, hash, in, keys, haskey, isempty, push!!, empty!!,
70+
# in, keys, haskey, isempty, push!!, empty!!,
7171
# getindex, setindex!, getproperty, setproperty!
72-
csym = gensym()
73-
vn1 = @varname x[1][2]
74-
@test string(vn1) == "x[1][2]"
75-
@test Symbol(vn1) == Symbol("x[1][2]")
76-
77-
vn2 = @varname x[1][2]
78-
@test vn2 == vn1
79-
@test hash(vn2) == hash(vn1)
8072

8173
function test_base(vi_original)
8274
vi = deepcopy(vi_original)
@@ -179,14 +171,14 @@ end
179171
@testset "setval! & setval_and_resample!" begin
180172
@model function testmodel(x)
181173
n = length(x)
182-
s ~ truncated(Normal(), 0, Inf)
174+
s ~ truncated(Normal(); lower=0)
183175
m ~ MvNormal(zeros(n), I)
184176
return x ~ MvNormal(m, s^2 * I)
185177
end
186178

187179
@model function testmodel_univariate(x, ::Type{TV}=Vector{Float64}) where {TV}
188180
n = length(x)
189-
s ~ truncated(Normal(), 0, Inf)
181+
s ~ truncated(Normal(); lower=0)
190182

191183
m = TV(undef, n)
192184
for i in eachindex(m)
@@ -444,10 +436,10 @@ end
444436
end
445437

446438
@testset "istrans" begin
447-
@model demo_constrained() = x ~ truncated(Normal(), 0, Inf)
439+
@model demo_constrained() = x ~ truncated(Normal(); lower=0)
448440
model = demo_constrained()
449441
vn = @varname(x)
450-
dist = truncated(Normal(), 0, Inf)
442+
dist = truncated(Normal(); lower=0)
451443

452444
### `VarInfo`
453445
# Need to run once since we can't specify that we want to _sample_

0 commit comments

Comments
 (0)