Support for bidirectional_dynamic_rnn?
Has any work been done on supporting dynamic unrolling of inputs as in TF’s {bidirectional_}dynamic_rnn?
mattmacy
<SCODE>#TensorFlow (should be run once, during `__init__`)
cond = lambda i, h: i < tf.shape(words)[0]
cell = lambda i, h: rnn_unit(words[i], h)
i = 0
_, h = tf.while_loop(cond, cell, (i, h0))


#PyTorch (should be run for every batch, during `forward`)
h = h0
for word in words:
    h = rnn_unit(word, h)
<ECODE>
jekbradbury
Thanks. The python/ops/rnn.py code is so involved / convoluted I thought that there must be something more going on that that.
mattmacy
mattmacy
ngimel
Also, note that you can use pack_padded_sequence 93 to allow sequences of different length inside a minibatch it’s perfectly fine to use minibatches with different sequence lengths in every call to LSTM If your application allows that, using nn.LSTM instead of manually unrolled nn.LSTMCell you can easily observe a 10x speedups.
elanmart
Can I just pack/pad the sentences in the minibatch and feed that to a BiLSTM?
mattmacy
ngimel