Implementing dynamic_bidirectional_rnn to tf.layer.Bidirectional

Viewed 90

I have used BasicLSTM, MulttiRNNCell, bidirectional_dynamic_rnn in a code for testing the code for proof of concept, which was a success but now for publishing code for the production level I need to update this bidirectional layers to fit for the upcoming version of tensorflow version 2.0.

for now, tensorflow show these layers are depreciated and will be removed in future versiontf2.0 particularly for this libraries the instruction for update was to use keras.layers.StackedRNNCells which is not working for me.

cells = [tf.contrib.rnn.LSTMCell(num_units=numHidden, state_is_tuple=True) for _ in range(2)] # 2 layers
stacked = tf.contrib.rnn.MultiRNNCell(cells, state_is_tuple=True)
((fw, bw), _)=tf.nn.bidirectional_dynamic_rnn(cell_fw=stacked,cell_bw=stacked, inputs=rnnIn3d, dtype=rnnIn3d.dtype)
0 Answers
Related