Skip to content

Commit 5d16619

Browse files
author
mosesmakola
committed
removed all upper bounds of inf for truncated method call
1 parent 4286f09 commit 5d16619

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ end
182182
@testset "setval! & setval_and_resample!" begin
183183
@model function testmodel(x)
184184
n = length(x)
185-
s ~ truncated(Normal(), 0, Inf)
185+
s ~ truncated(Normal(); lower=0)
186186
m ~ MvNormal(zeros(n), I)
187187
return x ~ MvNormal(m, s^2 * I)
188188
end
189189

190190
@model function testmodel_univariate(x, ::Type{TV}=Vector{Float64}) where {TV}
191191
n = length(x)
192-
s ~ truncated(Normal(), 0, Inf)
192+
s ~ truncated(Normal(); lower=0)
193193

194194
m = TV(undef, n)
195195
for i in eachindex(m)
@@ -447,10 +447,10 @@ end
447447
end
448448

449449
@testset "istrans" begin
450-
@model demo_constrained() = x ~ truncated(Normal(), 0, Inf)
450+
@model demo_constrained() = x ~ truncated(Normal(); lower=0)
451451
model = demo_constrained()
452452
vn = @varname(x)
453-
dist = truncated(Normal(), 0, Inf)
453+
dist = truncated(Normal(); lower=0)
454454

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

0 commit comments

Comments
 (0)