title: How can I assign a unique id to each datapoint in a queue?
body: <p>I'm using queues to load data in tensorflow.  My data is stored in TFRecords.  The problem is that I want a unique id associated with each data point, but I don't know how to do this.  (The UID will be used to either filter portions of the dataset, or add noise to the dataset; the UID is need to ensure that in each epoch, the same data points get filtered or the same noise gets added.)</p>
  
  <p>I read the datapoints using this code:</p>
  
  <pre><code>filename_queue = tf.train.string_input_producer(datapaths)
  reader = tf.TFRecordReader()
  _, serialized_example = reader.read(filename_queue)
  features = tf.parse_single_example(
      serialized_example,
      features={
          'image_raw': tf.FixedLenFeature([], tf.string),
          'label': tf.FixedLenFeature([], tf.int64),
      })
  image = tf.decode_raw(features['image_raw'], tf.uint8)
  label = tf.cast(features['label'], tf.int32
  </code></pre>
  
  <p>I then use <code>image</code> and <code>label</code> variables like normal.  I want to also have a <code>uid</code> variable that is unique for each data point.  Ideally, this would be an integer between 0 and the size of the dataset, and <code>uid</code> would just be the index of the current data point.  How can I create this <code>uid</code> variable?</p>