From b60df53ba1beb79be342c304787b6021c73a0883 Mon Sep 17 00:00:00 2001 From: Mike Innes Date: Thu, 19 Sep 2019 18:33:33 +0100 Subject: [PATCH] pkg up --- Manifest.toml | 20 +++++++++++--------- Project.toml | 1 + src/Flux.jl | 2 +- test/cuda/cudnn.jl | 10 +++++----- test/cuda/curnn.jl | 6 +++--- test/layers/normalisation.jl | 4 ++-- test/layers/stateless.jl | 2 +- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 2d1af7e8..c524a684 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -46,9 +46,9 @@ version = "0.6.2" [[CUDAapi]] deps = ["Libdl", "Logging"] -git-tree-sha1 = "9b2b4b71d6b7f946c9689bb4dea03ff92e3c7091" +git-tree-sha1 = "e063efb91cfefd7e6afd92c435d01398107a500b" uuid = "3895d2a7-ec45-59b8-82bb-cfc6a382f9b3" -version = "1.1.0" +version = "1.2.0" [[CUDAdrv]] deps = ["CUDAapi", "Libdl", "Printf"] @@ -147,9 +147,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[FFTW]] deps = ["AbstractFFTs", "BinaryProvider", "Conda", "Libdl", "LinearAlgebra", "Reexport", "Test"] -git-tree-sha1 = "03f8776fbdae28c20c0d1d2ae4e090cd1dfcd247" +git-tree-sha1 = "6c5b420da0b8c12098048561b8d58f81adea506f" uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" -version = "1.0.0" +version = "1.0.1" [[FillArrays]] deps = ["LinearAlgebra", "Random", "SparseArrays"] @@ -170,9 +170,9 @@ version = "0.10.3" [[GPUArrays]] deps = ["Adapt", "FFTW", "FillArrays", "LinearAlgebra", "Printf", "Random", "Serialization", "StaticArrays", "Test"] -git-tree-sha1 = "b5009ac44b141ded5e6f04c4db83807970f56e91" +git-tree-sha1 = "77e27264276fe97a7e7fb928bf8999a145abc018" uuid = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7" -version = "1.0.2" +version = "1.0.3" [[IRTools]] deps = ["InteractiveUtils", "MacroTools", "Test"] @@ -388,7 +388,7 @@ version = "0.8.3" [[Zygote]] deps = ["DiffRules", "FFTW", "FillArrays", "ForwardDiff", "IRTools", "InteractiveUtils", "LinearAlgebra", "MacroTools", "NNlib", "NaNMath", "Random", "Requires", "SpecialFunctions", "Statistics", "ZygoteRules"] -git-tree-sha1 = "ce6d7142d665b1e4c71c678fa7db4da3bbc6743f" +git-tree-sha1 = "38241b40ebd8748bcacad5e6c7ba3ab3cc7a15c9" repo-rev = "master" repo-url = "https://github.com/FluxML/Zygote.jl.git" uuid = "e88e6eb3-aa80-5325-afca-941959d7151f" @@ -396,6 +396,8 @@ version = "0.3.4" [[ZygoteRules]] deps = ["MacroTools"] -git-tree-sha1 = "def5f96ac2895fd9b48435f6b97020979ee0a4c6" +git-tree-sha1 = "c4c29b30b8ff3be13d4244e78be7df2a42bc54d0" +repo-rev = "master" +repo-url = "https://github.com/FluxML/ZygoteRules.jl.git" uuid = "700de1a5-db45-46bc-99cf-38207098b444" -version = "0.1.0" +version = "0.2.0" diff --git a/Project.toml b/Project.toml index 2fcdc943..a55d1385 100644 --- a/Project.toml +++ b/Project.toml @@ -24,6 +24,7 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" +ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444" [compat] CUDAapi = "1.1" diff --git a/src/Flux.jl b/src/Flux.jl index 9d1fbfc5..a46dc383 100644 --- a/src/Flux.jl +++ b/src/Flux.jl @@ -6,7 +6,7 @@ using Base: tail using Zygote, MacroTools, Juno, Reexport, Statistics, Random using MacroTools: @forward @reexport using NNlib -using Zygote: Params, @adjoint, gradient, forward +using Zygote: Params, @adjoint, gradient, pullback export gradient export Chain, Dense, Maxout, RNN, LSTM, GRU, Conv, CrossCor, ConvTranspose, MaxPool, MeanPool, diff --git a/test/cuda/cudnn.jl b/test/cuda/cudnn.jl index a7fc244e..881e0b39 100644 --- a/test/cuda/cudnn.jl +++ b/test/cuda/cudnn.jl @@ -1,5 +1,5 @@ using Flux, CuArrays, Test -using Flux: forward +using Flux: pullback @testset "CUDNN BatchNorm" begin @testset "4D Input" begin @@ -8,8 +8,8 @@ using Flux: forward cx = gpu(x) cm = gpu(m) - y, back = forward((m, x) -> m(x), m, x) - cy, cback = forward((m, x) -> m(x), cm, cx) + y, back = pullback((m, x) -> m(x), m, x) + cy, cback = pullback((m, x) -> m(x), cm, cx) @test cpu(cy) ≈ y @@ -28,8 +28,8 @@ using Flux: forward cx = gpu(x) cm = gpu(m) - y, back = forward((m, x) -> m(x), m, x) - cy, cback = forward((m, x) -> m(x), cm, cx) + y, back = pullback((m, x) -> m(x), m, x) + cy, cback = pullback((m, x) -> m(x), cm, cx) @test cpu(cy) ≈ y diff --git a/test/cuda/curnn.jl b/test/cuda/curnn.jl index 1e834d14..47ec8509 100644 --- a/test/cuda/curnn.jl +++ b/test/cuda/curnn.jl @@ -1,5 +1,5 @@ using Flux, CuArrays, Test -using Flux: forward +using Flux: pullback @testset for R in [RNN, GRU, LSTM] m = R(10, 5) |> gpu @@ -22,8 +22,8 @@ end rand(10, batch_size) cux = gpu(x) - y, back = forward((r, x) -> (r(x)), rnn, x) - cuy, cuback = forward((r, x) -> (r(x)), curnn, cux) + y, back = pullback((r, x) -> (r(x)), rnn, x) + cuy, cuback = pullback((r, x) -> (r(x)), curnn, cux) @test y ≈ collect(cuy) @test haskey(Flux.CUDA.descs, curnn.cell) diff --git a/test/layers/normalisation.jl b/test/layers/normalisation.jl index cda0cc59..d940b5ab 100644 --- a/test/layers/normalisation.jl +++ b/test/layers/normalisation.jl @@ -1,7 +1,7 @@ using Flux, Test, Statistics -using Zygote: forward +using Zygote: pullback -trainmode(f, x...) = forward(f, x...)[1] +trainmode(f, x...) = pullback(f, x...)[1] trainmode(f) = (x...) -> trainmode(f, x...) @testset "Dropout" begin diff --git a/test/layers/stateless.jl b/test/layers/stateless.jl index b853fc19..9e01af07 100644 --- a/test/layers/stateless.jl +++ b/test/layers/stateless.jl @@ -55,7 +55,7 @@ const ϵ = 1e-7 y = rand(T, 2) ŷ = rand(T, 2) for f in (mse, crossentropy, logitcrossentropy) - fwd, back = Flux.forward(f, ŷ, y) + fwd, back = Flux.pullback(f, ŷ, y) @test fwd isa T @test eltype(back(one(T))[1]) == T end