Skip to content

Instantly share code, notes, and snippets.

@felipessalvatore
Created September 29, 2017 17:24
Show Gist options
  • Save felipessalvatore/e7bd4f47d81e74e9b2eac82d7917fb93 to your computer and use it in GitHub Desktop.
Save felipessalvatore/e7bd4f47d81e74e9b2eac82d7917fb93 to your computer and use it in GitHub Desktop.
script to grasp what the idea behind the range_input_producer
# range_input_producer(
# limit,
# num_epochs=None,
# shuffle=True,
# seed=None,
# capacity=32,
# shared_name=None,
# name=None)
# Produces the integers from 0 to limit-1 in a queue.
import tensorflow as tf
i = tf.train.range_input_producer(10, shuffle=False).dequeue()
with tf.Session() as sess:
coord = tf.train.Coordinator()
tf.train.start_queue_runners(sess, coord=coord)
try:
for step in range(11):
print(sess.run(i))
except Exception as e:
print("Exception")
coord.request_stop()
finally:
coord.request_stop()
coord.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment