0

I want to be able to feed a initial state to a network via a placeholder and TensorFlow only allow array or tensor to be feed (And I don't know how to create a zer initiale state tuple) . But the tf.nn.dynamic_rnn function recquire a tuple of size 3. In the answer of this post: How do I set TensorFlow RNN state when state_is_tuple=True?

is exposed a method to do this conversion but the function utilised l = tf.unpack(state_placeholder, axis=0) doesn't exist anymore. How can i perform the conversion from a tensor of shape (num_layer,2,batch_size,hidden_layers) feed to a placeholder to a tupple acceptable by tf.nn.dynamic_rnn as a initial_state argument?

2 Answers2

0

tf.unpack got replaced with tf.unstack. Can you use that instead?

Alexandre Passos
  • 5,186
  • 1
  • 14
  • 19
0

tf.unstack seems to do the work but the tf.nn.dynamic_rnn still throw me an eror message : AttributeError: 'LSTMStateTuple' object has no attribute 'get_shape' If It's not an LSTMStateTuple that is expected what is it?

The total stack trace error is: enter image description here