Evaluate variable-length input array RNN in Julia Flux

julia> map(c) do v
         reset!(simple_rnn)
         simple_rnn.(v)
       end
┌ Warning: Broadcasting is not safe to use with RNNs, as it does not guarantee an iteration order.
│ Re-writing this as a comprehension would be better.
│   caller = (::var"#21#22")(v::Vector{Vector{Float32}}) at REPL[46]:3
└ @ Main ./REPL[46]:3
3-element Vector{Vector{Vector{Float32}}}:
 [[-0.32932267], [-1.0383314], [-2.1850915]]
 [[-0.65864533], [-2.0766628], [-4.04086], [-6.6347656]]
 [[-1.9759359], [-4.583375], [-7.58957], [-12.04347], [-16.190538], [-21.30114]]

I suppose you want the reset! here to not carry over state between batches.

Note the warning though. The broadcast . should really be written as [simple_rnn(x) for x in v] to guarantee order.

2 Likes