Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry-picked improvements + fixes from jr/mnist (including compat fixes for v0.6) #47

Merged
merged 14 commits into from
Jan 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ notifications:
email: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd()); Pkg.build("ReverseDiff"); Pkg.checkout("DiffBase"); Pkg.test("ReverseDiff"; coverage=true)'
- julia -e 'Pkg.clone(pwd()); Pkg.build("ReverseDiff"); Pkg.test("ReverseDiff"; coverage=true)'
after_success:
# push coverage results to Coveralls
- julia -e 'cd(Pkg.dir("ReverseDiff")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ReverseDiff

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

[**Go To ReverseDiff's Documentation**](http://www.juliadiff.org/ReverseDiff.jl/)
Expand Down
6 changes: 3 additions & 3 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.5
DiffBase 0.0.2
ForwardDiff 0.3.2
Calculus 0.1.15
DiffBase 0.0.3
ForwardDiff 0.3.4
Calculus 0.2.0
5 changes: 4 additions & 1 deletion src/ReverseDiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ const SKIPPED_BINARY_SCALAR_FUNCS = (:isequal, :isless, :<, :>, :(==), :(!=), :(
include("tape.jl")
include("tracked.jl")
include("macros.jl")
include("derivatives/propagation.jl")
include("derivatives/scalars.jl")
include("derivatives/linalg.jl")
include("derivatives/elementwise.jl")
include("derivatives/linalg/arithmetic.jl")
include("derivatives/linalg/reductions.jl")
include("derivatives/linalg/special.jl")
include("api/utils.jl")
include("api/Config.jl")
include("api/tape.jl")
Expand Down
1 change: 1 addition & 0 deletions src/api/Config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function JacobianConfig{D}(output::AbstractArray{D}, input::Tuple, tp::RawTape =
return _JacobianConfig(cfg_input, cfg_output, tp)
end

# we dispatch on V<:Real here because RawTape is actually also an AbstractArray
function JacobianConfig{D,V<:Real}(output::AbstractArray{D}, input::AbstractArray{V}, tp::RawTape = RawTape())
cfg_input = track(similar(input), D, tp)
cfg_output = track!(similar(output, TrackedReal{D,D,Void}), output, tp)
Expand Down
4 changes: 2 additions & 2 deletions src/api/gradients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ function gradient!(result, f, input, cfg::GradientConfig = GradientConfig(input)
return result
end

#############################
###########################
# Executing GradientTapes #
#############################
###########################

"""
ReverseDiff.gradient!(tape::Union{GradientTape,CompiledGradient}, input)
Expand Down
4 changes: 2 additions & 2 deletions src/api/hessians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ function hessian!(result::DiffResult, f, input::AbstractArray,
return result
end

############################
##########################
# Executing HessianTapes #
############################
##########################

"""
ReverseDiff.hessian!(tape::Union{HessianTape,CompiledHessian}, input)
Expand Down
4 changes: 2 additions & 2 deletions src/api/jacobians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ function jacobian!(result, f!, output, input, cfg::JacobianConfig = JacobianConf
return result
end

#############################
###########################
# Executing JacobianTapes #
#############################
###########################

"""
ReverseDiff.jacobian!(tape::Union{JacobianTape,CompiledJacobian}, input)
Expand Down
11 changes: 8 additions & 3 deletions src/api/tape.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ object can be passed to any API methods that accept `t`.
In many cases, compiling `t` can significantly speed up execution time. Note that the longer
the tape, the more time compilation may take. Very long tapes (i.e. when `length(t)` is on
the order of 10000 elements) can take a very long time to compile.

Note that this function calls `eval` in the `current_module()` to generate functions
from `t`. Thus, the returned `Compiled*` type will only be useable once the world-age
counter has caught up with the world-age of the `eval`'d functions (i.e. once the call
stack has bubbled up to top level).
"""
function compile(t::AbstractTape)
return Compiled(typeof(t), t.func, t.input, t.output,
Expand All @@ -93,7 +98,7 @@ The arguments to `ReverseDiff.compile_gradient` are the same as the arguments to

The usage restrictions on the returned function are the same as the usage restrictions
for calling `gradient!(result, tape, input)` where `tape` is a compiled `GradientTape`;
see `ReverseDiff.compile` for details.
see `ReverseDiff.compile` for details (including an important note on world-age).
"""
function compile_gradient(f, args...)
tape = compile(GradientTape(f, args...))
Expand All @@ -115,7 +120,7 @@ this means `ReverseDiff.compile_jacobian` also supports target functions of the

The usage restrictions on the returned function are the same as the usage restrictions
for calling `jacobian!(result, tape, input)` where `tape` is a compiled `JacobianTape`;
see `ReverseDiff.compile` for details.
see `ReverseDiff.compile` for details (including an important note on world-age).
"""
function compile_jacobian(f, args...)
tape = compile(JacobianTape(f, args...))
Expand All @@ -135,7 +140,7 @@ The arguments to `ReverseDiff.compile_hessian` are the same as the arguments to

The usage restrictions on the returned function are the same as the usage restrictions
for calling `hessian!(result, tape, input)` where `tape` is a compiled `HessianTape`;
see `ReverseDiff.compile` for details.
see `ReverseDiff.compile` for details (including an important note on world-age).
"""
function compile_hessian(f, args...)
tape = compile(HessianTape(f, args...))
Expand Down
Loading