1
$\begingroup$

Does tf.contrib.rnn.LSTMCell assign itself an initial state of zeros or is it random for each batch or per complete run through (if I run the model twice will it have the same initial state both the times)?

$\endgroup$
1
$\begingroup$

If you don't specify the initial_state parameter on tf.nn.rnn(), the states will be initialized as zero vectors for each batch.

$\endgroup$
  • $\begingroup$ which means if i run the same model twice (taking the prediction twice) inside the same script, the initial state of the LSTM will be the same for both the 1st and the 2nd iteration right? $\endgroup$ – Suleka_28 Feb 2 at 21:31
  • $\begingroup$ @Suleka_28 just now I realized I didn't understand your question properly. The answer is indeed yes; unless you treat them as variables, they will remain the same throughout iterations. This approach is actually advised. Here's a great post on this. $\endgroup$ – Lucas Farias Feb 2 at 23:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.