From 1f688198a1849e2b0bd181b99d5747da695370fa Mon Sep 17 00:00:00 2001 From: Abhirath Anand <74202102+theabhirath@users.noreply.github.com> Date: Sat, 2 Apr 2022 09:36:52 +0530 Subject: [PATCH] Undo breaking changes --- src/layers/basic.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/layers/basic.jl b/src/layers/basic.jl index 7ddb04bdf2..02033f3250 100644 --- a/src/layers/basic.jl +++ b/src/layers/basic.jl @@ -138,13 +138,13 @@ julia> Flux.params(d1) # no trainable bias Params([[1.0 1.0 … 1.0 1.0; 1.0 1.0 … 1.0 1.0]]) ``` """ -struct Dense{M<:AbstractMatrix, B, F} +struct Dense{F, M<:AbstractMatrix, B} weight::M bias::B σ::F function Dense(W::M, bias = true, σ::F = identity) where {M<:AbstractMatrix, F} b = create_bias(W, bias, size(W,1)) - new{M, typeof(b), F}(W, b, σ) + new{F,M,typeof(b)}(W, b, σ) end end @@ -156,9 +156,8 @@ end @functor Dense function (a::Dense)(x::AbstractVecOrMat) - W, b = a.weight, a.bias σ = NNlib.fast_act(a.σ, x) # replaces tanh => tanh_fast, etc - return σ.(W * x .+ b) + return σ.(a.weight * x .+ a.bias) end (a::Dense)(x::AbstractArray) =