clearer name for dense
This commit is contained in:
parent
fe2b35facc
commit
f6771b98cd
@ -7,7 +7,7 @@ module Flux
|
|||||||
using Juno
|
using Juno
|
||||||
using Lazy: @forward
|
using Lazy: @forward
|
||||||
|
|
||||||
export Chain, Linear
|
export Chain, Dense
|
||||||
|
|
||||||
using NNlib
|
using NNlib
|
||||||
export σ, relu, softmax
|
export σ, relu, softmax
|
||||||
|
@ -23,23 +23,23 @@ function Base.show(io::IO, c::Chain)
|
|||||||
print(io, ")")
|
print(io, ")")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Linear
|
# Dense
|
||||||
|
|
||||||
struct Linear{F,S,T}
|
struct Dense{F,S,T}
|
||||||
σ::F
|
σ::F
|
||||||
W::S
|
W::S
|
||||||
b::T
|
b::T
|
||||||
end
|
end
|
||||||
|
|
||||||
Linear(in::Integer, out::Integer, σ = identity; init = initn) =
|
Dense(in::Integer, out::Integer, σ = identity; init = initn) =
|
||||||
Linear(σ, track(init(out, in)), track(init(out)))
|
Dense(σ, track(init(out, in)), track(init(out)))
|
||||||
|
|
||||||
Optimise.children(d::Linear) = (d.W, d.b)
|
Optimise.children(d::Dense) = (d.W, d.b)
|
||||||
|
|
||||||
(a::Linear)(x) = a.σ.(a.W*x .+ a.b)
|
(a::Dense)(x) = a.σ.(a.W*x .+ a.b)
|
||||||
|
|
||||||
function Base.show(io::IO, l::Linear)
|
function Base.show(io::IO, l::Dense)
|
||||||
print(io, "Linear(", size(l.W, 2), ", ", size(l.W, 1))
|
print(io, "Dense(", size(l.W, 2), ", ", size(l.W, 1))
|
||||||
l.σ == identity || print(io, ", ", l.σ)
|
l.σ == identity || print(io, ", ", l.σ)
|
||||||
print(io, ")")
|
print(io, ")")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user