simplify recurrent layer

This commit is contained in:
Mike J Innes 2016-10-30 16:07:18 +00:00
parent a6fe1f3810
commit 508364407e

View File

@ -1,15 +1,12 @@
export Recurrent export Recurrent
@net type Recurrent @net type Recurrent
Wxh; Whh; Why Wxy; Wyy; by
bh; by y
hidden
function (x) function (x)
hidden = σ( x * Wxh + hidden * Whh + bh ) y = tanh( x * Wxy + y * Wyy + by )
y = hidden * Why + by
end end
end end
Recurrent(in::Integer, hidden::Integer, out::Integer; init = initn) = Recurrent(in, out; init = initn) =
Recurrent(init((in, hidden)), init((hidden, hidden)), init((hidden, out)), Recurrent(init((in, out)), init((out, out)), init(out), init(out))
init(hidden), init(out), zeros(Float32, hidden))