Skip to content

Commit 29e6edf

Browse files
yebaiemilemathieu
authored andcommitted
Solve compatibility with Julia 0.6 (#341, #330, #293)
* Initial support for infix ~ (#173). * seperate model wrapper call in sample.jl test * update ForwardDiff.Dual signature * sample.jl test passed * fix some tests for Julia 0.6 * remove typealias for 0.6 * make some functions 0.6-ish * make abstract 0.6-ish * change some decpreated functions * Update .travis.yml * Update appveyor.yml * Update appveyor.yml * fix test * Deprecations on package loading fixed * fix deprecations * implement callbacks for inner function * fix model type bug * Fix type * update Dual in benchmark * update Dual constructor * Bump up required Julia version to 0.6 * Disable depreciated warning messages for `consume/produce`. * Remove duplicate definition of produce. * fix floor, tanh, abs, log * fix logpdf warning and bug * fix vec assume init * Travis: Allow `Benchmarking` test to fail.
1 parent a03d7f5 commit 29e6edf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+434
-316
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ addons:
88
- g++-5
99
language: julia
1010
julia:
11-
- 0.5
11+
- 0.6
1212
os:
1313
- linux
1414
- osx
@@ -36,6 +36,7 @@ matrix:
3636
allow_failures:
3737
- env: GROUP=Test
3838
os: osx
39+
- env: GROUP=Bench
3940
- env: GROUP=LDA
4041
- env: GROUP=MOC
4142
- env: GROUP=SV

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
julia 0.5
1+
julia 0.6
22

33
Stan
44
Distributions 0.11.0

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
environment:
22
matrix:
3-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5.0-win64.exe"
3+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6.0-win64.exe"
44
MINGW_DIR: mingw64
55
# MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.3.0/threads-win32/seh/x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z/download
66
MINGW_URL: http://mlg.eng.cam.ac.uk/hong/x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z
77
MINGW_ARCHIVE: x86_64-5.3.0-release-win32-seh-rt_v4-rev0.7z
8-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5.0-win32.exe"
8+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6.0-win32.exe"
99
MINGW_DIR: mingw32
1010
# MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/5.3.0/threads-win32/dwarf/i686-5.3.0-release-win32-dwarf-rt_v4-rev0.7z/download
1111
MINGW_URL: http://mlg.eng.cam.ac.uk/hong/i686-5.3.0-release-win32-dwarf-rt_v4-rev0.7z

benchmarks/optimization.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ optRes *= "realpart(): \n"
290290

291291
using ForwardDiff: Dual
292292

293-
ds = [Dual{10,Float64}(rand()) for i = 1:1000]
293+
ds = [Dual{Void,Float64,10}(rand()) for i = 1:1000]
294294

295295
t_map = @elapsed for i = 1:1000 map(d -> d.value, ds) end
296296
t_list = @elapsed for i = 1:1000 Float64[ds[i].value for i = 1:length(ds)] end
@@ -304,7 +304,7 @@ optRes *= "Constructing Dual numbers: \n"
304304

305305
dps = zeros(44); dps[11] = 1;
306306

307-
t_dualnumbers = @elapsed for _ = 1:(44*2000*5) ForwardDiff.Dual(1.1, dps...) end
307+
t_dualnumbers = @elapsed for _ = 1:(44*2000*5) ForwardDiff.Dual{Void, Float64, 44}(1.1, dps) end
308308

309309
optRes *= "44*2000*5 times: $t_dualnumbers\n"
310310

example-models/nips-2017/gmm.model.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ p = [ 0.2, 0.2, 0.2, 0.2, 0.2]
2828
# μ = [ 0, 1, 2, 3.5, 4.25] + 0.5 * collect(0:4)
2929
μ = [ 0, 1, 2, 3.5, 4.25] + 2.5 * collect(0:4)
3030
s = [-0.5, -1.5, -0.75, -2, -0.5]
31-
σ = exp(s)
31+
σ = exp.(s)

example-models/nips-2017/sv.model.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
μ ~ Cauchy(0, 10)
66
h = tzeros(Real, T)
77
h[1] ~ Normal(μ, σ / sqrt(1 - ϕ^2))
8-
y[1] ~ Normal(0, exp(h[1] / 2))
8+
y[1] ~ Normal(0, exp.(h[1] / 2))
99
for t = 2:T
1010
h[t] ~ Normal+ ϕ * (h[t-1] - μ) , σ)
11-
y[t] ~ Normal(0, exp(h[t] / 2))
11+
y[t] ~ Normal(0, exp.(h[t] / 2))
1212
end
1313
end

example-models/nips-2017/sv.sim.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ for t in 2:T
1616
end
1717
y = Vector{Float64}(T);
1818
for t in 1:T
19-
y[t] = rand(Normal(0, exp(h[t] / 2)));
19+
y[t] = rand(Normal(0, exp.(h[t] / 2)));
2020
end
2121

2222

example-models/nuts-paper/lr_helper.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ readlrdata() = begin
77
open("lr_nuts.data") do f
88
while !eof(f)
99
raw_line = readline(f)
10-
data_str = filter(str -> length(str) > 0, split(raw_line, r"[ ]+")[1:end-1])
10+
data_str = Iterators.filter(str -> length(str) > 0, split(raw_line, r"[ ]+")[1:end-1])
1111
data = map(str -> parse(str), data_str)
1212
x = cat(1, x, data[1:end-1]')
1313
y = cat(1, y, data[end] - 1) # turn {1, 2} to {0, 1}

example-models/nuts-paper/sv_nuts.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ y = readsvdata()
1414
s[1] ~ Exponential(1/100)
1515
for i = 2:N
1616
s[i] ~ Normal(log(s[i-1]), τ)
17-
s[i] = exp(s[i])
17+
s[i] = exp.(s[i])
1818
dy = log(y[i] / y[i-1]) / s[i]
1919
dy ~ TDist(ν)
2020
end

example-models/sgld-paper/lr_helper.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ readlrdata() = begin
88
open("a9a2000.data") do f
99
while !eof(f)
1010
raw_line = readline(f)
11-
data_str = filter(str -> length(str) > 0, split(raw_line, r"[ ]+")[1:end-1])
11+
data_str = Iterators.filter(str -> length(str) > 0, split(raw_line, r"[ ]+")[1:end-1])
1212
data = map(str -> parse(str), data_str)
1313
x_tmp = zeros(Int32, d)
1414
x_tmp[data[2:end]] = 1

0 commit comments

Comments
 (0)