title: tf.train.string_input_producer behavior in a loop
body: <p>The following snippet has been taken from the TensorFlow 0.12 API documentation</p>
  
  <pre class="lang-py prettyprint-override"><code>def input_pipeline(filenames, batch_size, num_epochs=None):
    filename_queue = tf.train.string_input_producer(
        filenames, num_epochs=num_epochs, shuffle=True)
    example, label = read_my_file_format(filename_queue)
    # min_after_dequeue defines how big a buffer we will randomly sample
    #   from -- bigger means better shuffling but slower start up and more
    #   memory used.
    # capacity must be larger than min_after_dequeue and the amount larger
    #   determines the maximum we will prefetch.  Recommendation:
    #   min_after_dequeue + (num_threads + a small safety margin) * batch_size
    min_after_dequeue = 10000
    capacity = min_after_dequeue + 3 * batch_size
    example_batch, label_batch = tf.train.shuffle_batch(
        [example, label], batch_size=batch_size, capacity=capacity,
        min_after_dequeue=min_after_dequeue)
    return example_batch, label_batch
  </code></pre>
  
  <p>The question I have might be very basic for a regular TensorFlow user, but I am an absolute beginner. The question is the following :</p>
  
  <ul>
  <li><code>tf.train.string_input_producer</code> creates a queue for holding the filenames. As the <code>input_pipeline()</code> is called over and over again during training, how will it be ensured that everytime the same queue is used ? I guess, it is important since, if different calls to <code>input_pipeline()</code> result in a creation of a new queue, there does not seem to be a way to ensure that different images are picked everytime  and epoch counter and shuffling can be properly maintained.</li>
  </ul>