Skip to content

Commit

Permalink
Merge pull request #1873 from mkschleg/rnn_eachslice
Browse files Browse the repository at this point in the history
Changed view to eachslice for folding in recurrent
  • Loading branch information
ToucheSir authored Feb 13, 2022
2 parents 3cc9067 + c4338af commit 1f3915d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/layers/recurrent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ reset!(m) = foreach(reset!, functor(m)[1])
flip(f, xs) = reverse(f.(reverse(xs)))

function (m::Recur)(x::AbstractArray{T, 3}) where T
h = [m(view(x, :, :, i)) for i in 1:size(x, 3)]
h = [m(x_t) for x_t in eachslice(x, dims=3)]
sze = size(h[1])
reshape(reduce(hcat, h), sze[1], sze[2], length(h))
end
Expand Down

0 comments on commit 1f3915d

Please sign in to comment.