iterate over chain

This commit is contained in:
Mike J Innes 2017-03-07 14:37:37 +00:00
parent 2a57150bce
commit 06f2ee2284

View File

@ -21,6 +21,7 @@ type Chain <: Model
end
@forward Chain.layers Base.getindex, Base.first, Base.last, Base.endof
@forward Chain.layers Base.start, Base.next, Base.done
(s::Chain)(x) = foldl((x, m) -> m(x), x, s.layers)
back!(s::Chain, Δ) = foldr((m, Δ) -> back!(m, Δ), Δ, s.layers)