Skip to content

Commit c6ae6dd

Browse files
authored
deprecation fixes for Julia v0.7 (#110)
* deprecation fixes for Julia v0.7 * add note to warn new users * rm old CI badges * update Travis config for Pkg deprecation
1 parent 20ee111 commit c6ae6dd

27 files changed

+388
-430
lines changed

Diff for: .travis.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Documentation: http://docs.travis-ci.com/user/languages/julia/
22
language: julia
3-
os:
4-
- linux
53
julia:
6-
- 0.6
7-
- nightly
4+
- 0.7
5+
- 1.0
6+
- nightly
87
matrix:
98
allow_failures:
109
- julia: nightly
1110
notifications:
12-
email: false
11+
email: false
12+
sudo: false
1313
script:
14-
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
15-
- julia -e 'Pkg.clone(pwd()); Pkg.build("ReverseDiff"); Pkg.test("ReverseDiff"; coverage=VERSION >= v"0.6-")'
14+
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
15+
- julia -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("ReverseDiff"); Pkg.test("ReverseDiff"; coverage=true)'
1616
after_success:
17-
# push coverage results to Coveralls
18-
- julia -e 'cd(Pkg.dir("ReverseDiff")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
17+
# push coverage results to Coveralls
18+
- julia -e 'using Pkg; cd(Pkg.dir("ReverseDiff")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'

Diff for: README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# ReverseDiff
22

33
[![Build Status](https://travis-ci.org/JuliaDiff/ReverseDiff.jl.svg?branch=master)](https://travis-ci.org/JuliaDiff/ReverseDiff.jl)
4-
[![ReverseDiff](http://pkg.julialang.org/badges/ReverseDiff_0.5.svg)](http://pkg.julialang.org/?pkg=ReverseDiff)
5-
[![ReverseDiff](http://pkg.julialang.org/badges/ReverseDiff_0.6.svg)](http://pkg.julialang.org/?pkg=ReverseDiff)
64
[![Coverage Status](https://coveralls.io/repos/github/JuliaDiff/ReverseDiff.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaDiff/ReverseDiff.jl?branch=master)
75

86
[**Go To ReverseDiff's Documentation**](http://www.juliadiff.org/ReverseDiff.jl/)
97

108
[**See ReverseDiff Usage Examples**](https://github.com/JuliaDiff/ReverseDiff.jl/tree/master/examples)
119

10+
**Note: While ReverseDiff technically supports Julia v0.7/v1.0 and is somewhat maintained, it
11+
is currently not actively developed. Instead, ForwardDiff/ReverseDiff's maintainers are
12+
focused on the development of a new AD package built on top of [Cassette](https://github.com/jrevels/Cassette.jl).
13+
In the meantime, it might be worth checking out other reverse-mode AD implementations in Nabla.jl,
14+
AutoGrad.jl, Flux.jl, or XGrad.jl.**
15+
1216
ReverseDiff implements methods to take **gradients**, **Jacobians**, **Hessians**, and
1317
higher-order derivatives of native Julia functions (or any callable object, really) using
1418
**reverse mode automatic differentiation (AD)**.

Diff for: REQUIRE

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
julia 0.6
1+
julia 0.7
22
DiffResults 0.0.1
3-
DiffRules 0.0.1
3+
DiffRules 0.0.4
44
NaNMath 0.2.2
55
SpecialFunctions 0.1.0
6-
ForwardDiff 0.6.0
7-
StaticArrays 0.5.0
8-
Compat 0.19.0
9-
FunctionWrappers 0.1
6+
ForwardDiff 0.8.0
7+
StaticArrays 0.8.3
8+
FunctionWrappers 1.0.0

Diff for: src/ReverseDiff.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
__precompile__()
2-
31
module ReverseDiff
42

53
using Base: RefValue
6-
using FunctionWrappers: FunctionWrapper
4+
using Random
5+
using LinearAlgebra
6+
using Statistics
77

8-
using Compat
8+
using FunctionWrappers: FunctionWrapper
99

1010
using DiffResults
1111
using DiffResults: DiffResult

Diff for: src/api/Config.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ See `ReverseDiff.jacobian` for a description of acceptable types for `input`.
101101
"""
102102
function JacobianConfig(output::AbstractArray{D}, input::Tuple, tp::InstructionTape = InstructionTape()) where D
103103
cfg_input = map(x -> track(similar(x), D, tp), input)
104-
cfg_output = track!(similar(output, TrackedReal{D,D,Void}), output, tp)
104+
cfg_output = track!(similar(output, TrackedReal{D,D,Nothing}), output, tp)
105105
return _JacobianConfig(cfg_input, cfg_output, tp)
106106
end
107107

108108
# we dispatch on V<:Real here because InstructionTape is actually also an AbstractArray
109109
function JacobianConfig(output::AbstractArray{D}, input::AbstractArray{V}, tp::InstructionTape = InstructionTape()) where {D,V<:Real}
110110
cfg_input = track(similar(input), D, tp)
111-
cfg_output = track!(similar(output, TrackedReal{D,D,Void}), output, tp)
111+
cfg_output = track!(similar(output, TrackedReal{D,D,Nothing}), output, tp)
112112
return _JacobianConfig(cfg_input, cfg_output, tp)
113113
end
114114

Diff for: src/api/tape.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ end
5454

5555
struct CompiledTape{T<:AbstractTape} <: AbstractTape
5656
tape::T
57-
forward_exec::Vector{FunctionWrapper{Void, Tuple{}}}
58-
reverse_exec::Vector{FunctionWrapper{Void, Tuple{}}}
57+
forward_exec::Vector{FunctionWrapper{Nothing, Tuple{}}}
58+
reverse_exec::Vector{FunctionWrapper{Nothing, Tuple{}}}
5959
end
6060

6161
"""
@@ -100,8 +100,8 @@ methods on each instruction in the tape.
100100
"""
101101
function CompiledTape(t::T) where T<:AbstractTape
102102
CompiledTape{T}(t,
103-
[FunctionWrapper{Void, Tuple{}}(ForwardExecutor(instruction)) for instruction in t.tape],
104-
[FunctionWrapper{Void, Tuple{}}(ReverseExecutor(t.tape[i])) for i in length(t.tape):-1:1]
103+
[FunctionWrapper{Nothing, Tuple{}}(ForwardExecutor(instruction)) for instruction in t.tape],
104+
[FunctionWrapper{Nothing, Tuple{}}(ReverseExecutor(t.tape[i])) for i in length(t.tape):-1:1]
105105
)
106106
end
107107

Diff for: src/api/utils.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ function extract_result!(result::Tuple, output)
8989
end
9090

9191
function extract_result!(result::AbstractArray, output::TrackedReal, input::TrackedArray)
92-
copy!(result, deriv(input))
92+
copyto!(result, deriv(input))
9393
return result
9494
end
9595

9696
function extract_result!(result::DiffResult, output::TrackedReal, input::TrackedArray)
9797
result = DiffResults.value!(result, value(output))
98-
copy!(DiffResults.gradient(result), deriv(input))
98+
copyto!(DiffResults.gradient(result), deriv(input))
9999
return result
100100
end
101101

@@ -133,7 +133,7 @@ function extract_result_value!(result::AbstractArray, output::AbstractArray)
133133
end
134134

135135
function extract_result_value!(result::AbstractArray, output::TrackedArray)
136-
copy!(result, value(output))
136+
copyto!(result, value(output))
137137
return result
138138
end
139139

Diff for: src/derivatives/elementwise.jl

+18-18
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,11 @@ function broadcast_plus(x, y, ::Type{D}) where D
358358
tp = tape(x, y)
359359
out = track(value(x) .+ value(y), D, tp)
360360
cache = (index_bound(x, out), index_bound(y, out))
361-
record!(tp, SpecialInstruction, Base.:(.+), (x, y), out, cache)
361+
record!(tp, SpecialInstruction, (broadcast, +), (x, y), out, cache)
362362
return out
363363
end
364364

365-
@noinline function special_forward_exec!(instruction::SpecialInstruction{typeof(.+)})
365+
@noinline function special_forward_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(+)}})
366366
a, b = instruction.input
367367
output = instruction.output
368368
pull_value!(a)
@@ -371,7 +371,7 @@ end
371371
return nothing
372372
end
373373

374-
@noinline function special_reverse_exec!(instruction::SpecialInstruction{typeof(.+)})
374+
@noinline function special_reverse_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(+)}})
375375
a, b = instruction.input
376376
output = instruction.output
377377
output_deriv = deriv(output)
@@ -389,11 +389,11 @@ function broadcast_minus(x, y, ::Type{D}) where D
389389
tp = tape(x, y)
390390
out = track(value(x) .- value(y), D, tp)
391391
cache = (index_bound(x, out), index_bound(y, out))
392-
record!(tp, SpecialInstruction, Base.:(.-), (x, y), out, cache)
392+
record!(tp, SpecialInstruction, (broadcast, -), (x, y), out, cache)
393393
return out
394394
end
395395

396-
@noinline function special_forward_exec!(instruction::SpecialInstruction{typeof(.-)})
396+
@noinline function special_forward_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(-)}})
397397
a, b = instruction.input
398398
output = instruction.output
399399
pull_value!(a)
@@ -402,7 +402,7 @@ end
402402
return nothing
403403
end
404404

405-
@noinline function special_reverse_exec!(instruction::SpecialInstruction{typeof(.-)})
405+
@noinline function special_reverse_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(-)}})
406406
a, b = instruction.input
407407
output = instruction.output
408408
output_deriv = deriv(output)
@@ -420,11 +420,11 @@ function broadcast_mul(x, y, ::Type{D}) where D
420420
tp = tape(x, y)
421421
out = track(value(x) .* value(y), D, tp)
422422
cache = (index_bound(x, out), index_bound(y, out))
423-
record!(tp, SpecialInstruction, Base.:(.*), (x, y), out, cache)
423+
record!(tp, SpecialInstruction, (broadcast, *), (x, y), out, cache)
424424
return out
425425
end
426426

427-
@noinline function special_forward_exec!(instruction::SpecialInstruction{typeof(.*)})
427+
@noinline function special_forward_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(*)}})
428428
a, b = instruction.input
429429
output = instruction.output
430430
pull_value!(a)
@@ -433,7 +433,7 @@ end
433433
return nothing
434434
end
435435

436-
@noinline function special_reverse_exec!(instruction::SpecialInstruction{typeof(.*)})
436+
@noinline function special_reverse_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(*)}})
437437
a, b = instruction.input
438438
output = instruction.output
439439
output_deriv = deriv(output)
@@ -467,11 +467,11 @@ function broadcast_rdiv(x, y, ::Type{D}) where D
467467
cache = (n_partials, d_partials,
468468
index_bound(x, out), index_bound(y, out),
469469
index_bound(n_partials, out), index_bound(d_partials, out))
470-
record!(tp, SpecialInstruction, Base.:(./), (x, y), out, cache)
470+
record!(tp, SpecialInstruction, (broadcast, /), (x, y), out, cache)
471471
return out
472472
end
473473

474-
@noinline function special_forward_exec!(instruction::SpecialInstruction{typeof(./)})
474+
@noinline function special_forward_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(/)}})
475475
a, b = instruction.input
476476
a_value, b_value = value(a), value(b)
477477
n_partials, d_partials = instruction.cache
@@ -484,7 +484,7 @@ end
484484
return nothing
485485
end
486486

487-
@noinline function special_reverse_exec!(instruction::SpecialInstruction{typeof(./)})
487+
@noinline function special_reverse_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(/)}})
488488
a, b = instruction.input
489489
output = instruction.output
490490
output_deriv = deriv(output)
@@ -506,11 +506,11 @@ function broadcast_ldiv(x, y, ::Type{D}) where D
506506
cache = (n_partials, d_partials,
507507
index_bound(x, out), index_bound(y, out),
508508
index_bound(n_partials, out), index_bound(d_partials, out))
509-
record!(tp, SpecialInstruction, Base.:(.\), (x, y), out, cache)
509+
record!(tp, SpecialInstruction, (broadcast, \), (x, y), out, cache)
510510
return out
511511
end
512512

513-
@noinline function special_forward_exec!(instruction::SpecialInstruction{typeof(.\)})
513+
@noinline function special_forward_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(\)}})
514514
a, b = instruction.input
515515
a_value, b_value = value(a), value(b)
516516
n_partials, d_partials = instruction.cache
@@ -523,7 +523,7 @@ end
523523
return nothing
524524
end
525525

526-
@noinline function special_reverse_exec!(instruction::SpecialInstruction{typeof(.\)})
526+
@noinline function special_reverse_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(\)}})
527527
a, b = instruction.input
528528
output = instruction.output
529529
output_deriv = deriv(output)
@@ -563,11 +563,11 @@ function broadcast_pow(x, y, ::Type{D}) where D
563563
cache = (bs_partials, ex_partials,
564564
index_bound(x, out), index_bound(y, out),
565565
index_bound(bs_partials, out), index_bound(ex_partials, out))
566-
record!(tp, SpecialInstruction, Base.:(.^), (x, y), out, cache)
566+
record!(tp, SpecialInstruction, (broadcast, ^), (x, y), out, cache)
567567
return out
568568
end
569569

570-
@noinline function special_forward_exec!(instruction::SpecialInstruction{typeof(.^)})
570+
@noinline function special_forward_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(^)}})
571571
a, b = instruction.input
572572
a_value, b_value = value(a), value(b)
573573
bs_partials, ex_partials = instruction.cache
@@ -580,7 +580,7 @@ end
580580
return nothing
581581
end
582582

583-
@noinline function special_reverse_exec!(instruction::SpecialInstruction{typeof(.^)})
583+
@noinline function special_reverse_exec!(instruction::SpecialInstruction{Tuple{typeof(broadcast),typeof(^)}})
584584
a, b = instruction.input
585585
output = instruction.output
586586
output_deriv = deriv(output)

0 commit comments

Comments
 (0)