Torben. Torben. - 8 days ago 6
Python Question

What is the parameter "state_is_tuple" in TensorFlow used for?

I'm trying to figure out the structure of tensorflow code (r0.11) and have problems understanding the "state_is_tuple" parameter used in RNNs (currently looking at LSTMs).

In this post How do I set TensorFlow RNN state when state_is_tuple=True? it is said that the state_is_tuple option sets wether the state of the hidden neurons and the cell state are saved in a tuple or not.

So my questions are: Why does this parameter exist? What is it used for and why should I bother? In what cases should I set it to True/False?

Thanks for helping!

Answer

This is a change to an earlier implementation of the rnn_cell-class in which state was a concatenation of the hidden neurons and the cell state. In I think Release 0.11 this was changed to a preferred version of (hidden neurons, cell state), thus as a tuple.

In the future the old concatenation way will be deprecated. Until then default is concatenation, but if you already use the tuple way then state_is_tuple needs to be set to true.