Skip to content

Commit

Permalink
Undo breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
theabhirath committed Apr 2, 2022
1 parent c2c6ab7 commit 1f68819
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/layers/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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) =
Expand Down

0 comments on commit 1f68819

Please sign in to comment.