title: How to use Tensorflow queues in real example
body: <p>I have a Tensorflow  DNN model in with I use <code>feed_dict</code> to feed the Input 
  <code>Training and Test</code> data and the labels that belongs to them. To keep things simple  this the important part of the code: </p>
  
  <pre><code>def feed_dict(train):
  """Make a TensorFlow feed_dict: maps data onto Tensor placeholders."""
  if train == True :
      xs,ys = next_Training_Batch()
      drop_out_value = 0.9
  else:
      #Run a test
      xs,ys=  Testing_Data,Testing_Labels
      drop_out_value = 1
  return {x:xs,y_:ys,keep_prob:drop_out_value}
  for i in range(max_steps):
      if i%5 ==0: # Record summarie and Test-set accruracy
          summary, acc = sess.run([merged,accuracy], feed_dict=feed_dict(False))
          test_writer.add_summary(summary,i)
          #print('Accuracy at steps%s: %s '%(i,acc))
      else:# Record train set summaries and train
          if i%10==0:
              run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
              run_metadata = tf.RunMetadata()
              summary, _ = sess.run([merged, train_steps],
                            feed_dict=feed_dict(True),
                            options=run_options,
                            run_metadata=run_metadata)
              train_writer.add_run_metadata(run_metadata, 'step%03d' % i)
              train_writer.add_summary(summary, i)
          else:
              summary,_ = sess.run([merged, train_steps], feed_dict=feed_dict(True))
              train_writer.add_summary(summary,i)
  </code></pre>
  
  <p>I've been reading about the TF queue are a way more efficient, I've have huge difficulties get them running, here is what I've done so far: </p>
  
  <pre><code>    import tensorflow as tf
  
  '''
  # Both Training.csv and Test.csv  include the features values and the and labels as follows :
  Feature0  Feature1  Feature2  Feature3  Feature4  Feature5   .......  ClassID(Labels)  onehot
  0.200985  1.000000  0.064534  0.415348  0.005391  1.000000             1000             1
  0.151232  1.000000  0.048849  0.312474  0.007160  1.000000             2001             2
  0.061576  1.000000  0.026125  0.127097  0.017450  1.000000             1000             3
  ...............................................................................
  Each file has &gt; 2500 rows
  '''
  
  fileNames = ["Training.csv","Test.csv"]
  BATCH_SIZE = 20
  number_OF_features  = 450
  
  def batch_generator(fileNames):
      fileNames_queue = tf.train.string_input_producer(fileNames)
      reader = tf.TextLineReader(skip_header_lines=1)
      key , values = reader.read(fileNames_queue)
      record_defaults = [[1.0] for _ in range(number_OF_features)]
      content = tf.decode_csv(values,record_defaults = record_defaults)
      features = tf.stack(content[:-2])
      labels = content[-1]
      min_after_dequeue =10 * BATCH_SIZE
      capacity = 20*BATCH_SIZE
      # suffle the data
      data_batch, label_batch = tf.train.shuffle_batch([features, labels], batch_size=BATCH_SIZE,
      capacity =capacity , min_after_dequeue = min_after_dequeue)
      return data_batch , label_batch
  
  with tf.Session() as sess:
      coord = tf.train.Coordinator()
      threads = tf.train.start_queue_runners(coord=coord)
      for _ in range(100 ): # generating 100 batch
          sess.run(batch_generator(fileNames))
          # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
          # I just  don'T get how to proceed from this point
          # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
          coord.request_stop()
          coord.join(threads)
  </code></pre>
  
  <p>My question is how can I "feed"  data  in train and testing.  I've been reading TF docs but it didn't help.</p>
  
  <p>Ref: The code I wrote is based on this <a href="https://github.com/chiphuyen/tf-stanford-tutorials/tree/master/examples" rel="nofollow noreferrer">great tutorials</a></p>