title: TypeError: 'Tensor' object cannot be interpreted as an integer
body: <p>I am trying to run a loop based on the size of the array. how to do that in tensorflow ? For example </p>
  
  <pre><code># input pipeline with all files available in the folder
  a = tf.Variable([1,2,3,4,5],dtype = tf.int32)
  loop = tf.size(a)
  ....
  for i in range(loop):
      print(sess.run(a))
  </code></pre>
  
  <p>I wanted to print the array a for 5 times. but it says loop is a tensor object and cannot taken as integer. 
  I have tried taking the loop variable as </p>
  
  <pre><code>loop = tf.cast(tf.size(a),tf.int32),
  loop = tf.shape_n(a),
  loop = tf.shape(a)[0]
  </code></pre>
  
  <p>it has the same error. </p>