title: Tensorflow LSTM : ValueError: Shape must have rank at least 3
body: <p>How to use tf.unstack for feeding the input to LSTM rnn in tensorflow :</p>
  
  <p>So if my input shape is <code>[4,5,2]</code>  which is  <code>[batch_size , time_stamp , n_input]</code>  </p>
  
  <p>Now if i try:</p>
  
  <pre><code>dataet=[[[3, 5], [7, 2], [7, 6]],
          [[2, 5], [1, 3], [4, 3]],
          [[8, 1], [1, 8], [9, 3]],
          [[1, 5], [6, 7], [4, 9]]]
  
  
  
  import tensorflow as tf
  from tensorflow.contrib import rnn
  import numpy as np
  
  
  input_x=tf.placeholder(dtype=tf.int32,shape=[4,3,2])
  input_x=tf.cast(input_x,tf.float32)
  
  
  
  
  
  data=tf.unstack(input_x,3,axis=1)
  
  
  with tf.variable_scope('encoder') as scope:
      cell=rnn.LSTMCell(num_units=250)
      model=tf.nn.bidirectional_dynamic_rnn(cell,cell,inputs=data,dtype=tf.float32)
  
  output,(fs,fc)=model
  
  
  
  
  
  
  
  with tf.Session() as sess:
      unstack_output,output_n=sess.run([output,data],feed_dict={input_x:dataet})
      print(unstack_output,output_n)
  </code></pre>
  
  <p>I am getting the error :</p>
  
  <pre><code>/anaconda/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.6 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
    return f(*args, **kwds)
  Traceback (most recent call last):
    File "/Users/exepaul/Desktop/limit_exceed/nad.py", line 25, in &lt;module&gt;
      model=tf.nn.bidirectional_dynamic_rnn(cell,cell,inputs=data,dtype=tf.float32)
    File "/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/rnn.py", line 416, in bidirectional_dynamic_rnn
      time_major=time_major, scope=fw_scope)
    File "/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/rnn.py", line 632, in dynamic_rnn
      dtype=dtype)
    File "/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/rnn.py", line 695, in _dynamic_rnn_loop
      for input_ in flat_input)
    File "/anaconda/lib/python3.5/site-packages/tensorflow/python/ops/rnn.py", line 695, in &lt;genexpr&gt;
      for input_ in flat_input)
    File "/anaconda/lib/python3.5/site-packages/tensorflow/python/framework/tensor_shape.py", line 673, in with_rank_at_least
      raise ValueError("Shape %s must have rank at least %d" % (self, rank))
  ValueError: Shape (2, 4) must have rank at least 3
  </code></pre>
  
  <p>How to shape the input for RNN after tf.unstack ?</p>
  
  <p>I tried to check <a href="https://github.com/tflearn/tflearn/issues/818" rel="nofollow noreferrer">this</a> but there is no answer </p>
  
  <p>My setup</p>
  
  <pre><code>Tensorflow :  1.6.0
  
  Python 3.5.4 |Anaconda custom (x86_64)|
  
  Osx 10.12.4
  </code></pre>