From 0a04e3ba61b0cb951b41184971f30d6c41dbf510 Mon Sep 17 00:00:00 2001 From: Mike J Innes Date: Tue, 26 Jun 2018 14:30:46 +0100 Subject: [PATCH] Chain `activations` --- src/layers/basic.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/layers/basic.jl b/src/layers/basic.jl index ad374643..cf89df41 100644 --- a/src/layers/basic.jl +++ b/src/layers/basic.jl @@ -38,6 +38,11 @@ function Base.show(io::IO, c::Chain) print(io, ")") end +# Seem to need this for `accumulate`; try removing on 0.7 +Base.rcum_promote_type(op, ::Type, ::Type{Any}) = Any + +activations(c::Chain, x) = accumulate((x, m) -> m(x), x, c.layers) + """ Dense(in::Integer, out::Integer, σ = identity)