Last active
August 19, 2018 13:22
-
-
Save hadifar/323803dfd7a09da6d8d941d480b3be6e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| dataset = tf.data.TextLineDataset("file.txt") | |
| iterator = dataset.make_initializable_iterator() | |
| next_element = iterator.get_next() | |
| init_op = iterator.initializer | |
| with tf.Session() as sess: | |
| # Initialize the iterator | |
| sess.run(init_op) | |
| print(sess.run(next_element)) | |
| print(sess.run(next_element)) | |
| # Move the iterator back to the beginning | |
| print(sess.run(next_element)) | |
| sess.run(init_op) | |
| print(sess.run(next_element)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment