title: Iterate over a tensor dimension in Tensorflow
body: <p>I am trying to develop a seq2seq model from a low level  perspective (creating by myself all the tensors needed). I am trying to feed the model with a sequence of vectors as a two-dimensional tensor, however, i can't iterate over one dimension of the tensor to extract vector by vector. Does anyone know what could I do to feed a batch of vectors and later get them one by one?</p>
  
  <p>This is my code:</p>
  
  <pre><code>batch_size = 100
  hidden_dim = 5
  input_dim = embedding_dim
  time_size = 5
  
  
  
  input_sentence = tf.placeholder(dtype=tf.float64, shape=[embedding_dim,None], name='input')
  output_sentence = tf.placeholder(dtype=tf.float64, shape=[embedding_dim,None], name='output')
  
  input_array = np.asarray(input_sentence)
  output_array = np.asarray(output_sentence)
  
  gru_layer1 = GRU(input_array, input_dim, hidden_dim) #This is a class created by myself
  
  
  for i in range(input_array.shape[-1]):
      word = input_array[:,i]
      previous_state = gru_encoder.h_t
      gru_layer1.forward_pass(previous_state,word)
  </code></pre>
  
  <p>And this is the error that I get</p>
  
  <pre><code>TypeError: Expected binary or unicode string, got &lt;tf.Tensor 'input_7:0' shape=(10, ?) dtype=float64&gt;
  </code></pre>