Skip to content

Commit 5f74696

Browse files
github-actions[bot]CompatHelper Juliayebaitorfjelde
authored
CompatHelper: bump compat for Turing to 0.26 for package turing, (keep existing compat) (#484)
* CompatHelper: bump compat for Turing to 0.26 for package turing, (keep existing compat) * Update compiler.jl * Update prob_macro.jl * Update prob_macro.jl * fixed tests * added missing dep to tests --------- Co-authored-by: CompatHelper Julia <[email protected]> Co-authored-by: Hong Ge <[email protected]> Co-authored-by: Tor Erlend Fjelde <[email protected]>
1 parent 0388e99 commit 5f74696

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

test/prob_macro.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
end
3030
@testset "vector" begin
3131
n = 5
32-
@model function demo(x, n=n)
32+
@model function demo(x, n)
3333
m ~ MvNormal(zeros(n), I)
3434
return x ~ MvNormal(m, I)
3535
end
@@ -41,12 +41,12 @@
4141
loglike = logpdf(MvNormal(mval, I), xval)
4242
logjoint = logprior + loglike
4343

44-
model = demo(xval)
44+
model = demo(xval, n)
4545
@test logprob"m = mval | model = model" == logprior
4646
@test logprob"x = xval | m = mval, model = model" == loglike
4747
@test logprob"x = xval, m = mval | model = model" == logjoint
4848

49-
varinfo = VarInfo(demo(xval))
49+
varinfo = VarInfo(demo(xval, n))
5050
@test logprob"m = mval | model = model, varinfo = varinfo" == logprior
5151
@test logprob"x = xval | m = mval, model = model, varinfo = varinfo" == loglike
5252
# Currently, we cannot easily pre-allocate `VarInfo` for vector data

test/turing/Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[deps]
22
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
3+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
34
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
45
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
56
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
67

78
[compat]
89
DynamicPPL = "0.20, 0.21, 0.22, 0.23"
9-
Turing = "0.21, 0.22, 0.23, 0.24, 0.25"
10+
Turing = "0.21, 0.22, 0.23, 0.24, 0.25, 0.26"
1011
julia = "1.6"

test/turing/compiler.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@
9292
return priors
9393
end
9494

95-
chain = sample(gauss2(; x=x), PG(10), 10)
96-
chain = sample(gauss2(; x=x), SMC(), 10)
95+
@test_throws ErrorException chain = sample(gauss2(; x=x), PG(10), 10)
96+
@test_throws ErrorException chain = sample(gauss2(; x=x), SMC(), 10)
9797

98-
chain = sample(gauss2(Vector{Float64}; x=x), PG(10), 10)
99-
chain = sample(gauss2(Vector{Float64}; x=x), SMC(), 10)
98+
@test_throws ErrorException chain = sample(gauss2(Vector{Float64}; x=x), PG(10), 10)
99+
@test_throws ErrorException chain = sample(gauss2(Vector{Float64}; x=x), SMC(), 10)
100100
end
101101
@testset "new interface" begin
102102
obs = [0, 1, 0, 1, 1, 1, 1, 1, 1, 1]

test/turing/prob_macro.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
end
3333
@testset "vector" begin
3434
n = 5
35-
@model function demo(x, n=n)
35+
@model function demo(x; n)
3636
m ~ MvNormal(zeros(n), I)
3737
return x ~ MvNormal(m, I)
3838
end
3939
mval = rand(n)
4040
xval = rand(n)
4141
iters = 1000
4242

43-
model = demo(xval)
43+
model = demo(xval; n)
4444
varinfo = VarInfo(model)
4545
chain = MCMCChains.get_sections(
4646
sample(model, HMC(0.5, 1), iters; save_state=true), :parameters

test/turing/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using DynamicPPL
22
using Turing
3+
using LinearAlgebra
34

45
using Random
56
using Test

0 commit comments

Comments
 (0)