Skip to content

Instantly share code, notes, and snippets.

@hadifar
Last active September 15, 2018 15:06
Show Gist options
  • Select an option

  • Save hadifar/5cc9bf0d69d2ed68ccc0e342d49ae844 to your computer and use it in GitHub Desktop.

Select an option

Save hadifar/5cc9bf0d69d2ed68ccc0e342d49ae844 to your computer and use it in GitHub Desktop.
import tensorflow as tf
dataset = tf.data.TextLineDataset("file.txt")
iterator = dataset.make_one_shot_iterator()
next_element = iterator.get_next()
with tf.Session() as sess:
print(sess.run(next_element))
print(sess.run(next_element))
print(sess.run(next_element))
# print(sess.run(next_element)) --> throws exception!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment