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$

closed as off-topic by whuber Feb 3 at 12:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – whuber
If this question can be reworded to fit the rules in the help center, please edit the question.

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.