From aaa0a82b749817c751fa2287b1bc92a1a168417f Mon Sep 17 00:00:00 2001 From: janEbert Date: Thu, 24 Oct 2019 22:35:59 +0200 Subject: [PATCH] Slight modifications in `recurrent` docstrings --- src/layers/recurrent.jl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/layers/recurrent.jl b/src/layers/recurrent.jl index 05466b31..d9de9884 100644 --- a/src/layers/recurrent.jl +++ b/src/layers/recurrent.jl @@ -15,13 +15,13 @@ in the background. `cell` should be a model of the form: For example, here's a recurrent network that keeps a running total of its inputs: ```julia -accum(h, x) = (h+x, x) +accum(h, x) = (h + x, x) rnn = Flux.Recur(accum, 0) -rnn(2) # 2 -rnn(3) # 3 -rnn.state # 5 -rnn.(1:10) # apply to a sequence -rnn.state # 60 +rnn(2) # 2 +rnn(3) # 3 +rnn.state # 5 +rnn.(1:10) # apply to a sequence +rnn.state # 60 ``` """ mutable struct Recur{T} @@ -47,9 +47,10 @@ Base.show(io::IO, m::Recur) = print(io, "Recur(", m.cell, ")") Reset the hidden state of a recurrent layer back to its original value. -Assuming you have a `Recur` layer `rnn`, this is roughly equivalent to - - rnn.state = hidden(rnn.cell) +Assuming you have a `Recur` layer `rnn`, this is roughly equivalent to: +``` +rnn.state = hidden(rnn.cell) +``` """ reset!(m::Recur) = (m.state = m.init) reset!(m) = foreach(reset!, functor(m)[1])