using tf.nn.dynamic_rnn to make LSTM RNN of multiple hidden layers

511 Views Asked by At

I read the documentation of tf.dynamic.rnn in https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn

and used it to make a single layer rnn of multiple time-steps. I was wondering if I could use tf.dynamic.rnn to stack multiple hidden layers. Is it possible to do so?

1

There are 1 best solutions below

1
On BEST ANSWER

Please look at the following code snippet:

Layers = 2

LTSM_Layer = tf.contrib.rnn.BasicLSTMCell(rnn_size)
Cell = tf.contrib.rnn.MultiRNNCell([LTSM_Layer] * Layers)

Then pass this cell to tf.dynamic.rnn.