title: iterating tensor objects in tf.data api without eager execution
body: <p>data.Dataset api for converting my data into tensorflow objects and the code is </p>
  
  <pre><code>dataset = tf.data.Dataset.from_tensor_slices((input_tensor_train, target_tensor_train)).shuffle(BUFFER_SIZE)
  
  dataset = dataset.batch(BATCH_SIZE, drop_remainder=True)
  </code></pre>
  
  <p>in eager execution it is working fine with enumerate. But i like to iterator over the data without eager execution and i found some resources regarding this then i used </p>
  
  <pre><code>dataset.make_initializable_iterator()
  iterator.get_next()
  </code></pre>
  
  <p>to iterate over the dataset.</p>
  
  <p>But its giving the error </p>
  
  <blockquote>
    <p>Tensor objects are only iterable when eager execution is enabled. To iterate over this tensor use tf.map_fn.</p>
  </blockquote>
  
  <p>could anybody is there to help me to solve the error</p>
  
  <p><a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb" rel="nofollow noreferrer">and this is the original source code unchanged</a></p>