TensorFlow - Read all examples from a TFRecords at once?
<p>How do you read all examples from a TFRecords at once?</p>

<p>I've been using <code>tf.parse_single_example</code> to read out individual examples using code similar to that given in the method <code>read_and_decode</code> in the <a href="https://github.com/tensorflow/tensorflow/blob/r0.8/tensorflow/examples/how_tos/reading_data/fully_connected_reader.py" rel="noreferrer">example of the fully_connected_reader</a>. However, I want to run the network against my entire validation dataset at once, and so would like to load them in their entirety instead.</p>

<p>I'm not entirely sure, but <a href="https://www.tensorflow.org/versions/r0.8/api_docs/python/io_ops.html#parse_example" rel="noreferrer">the documentation</a> seems to suggest I can use <code>tf.parse_example</code> instead of <code>tf.parse_single_example</code> to load the entire TFRecords file at once. I can't seem to get this to work though. I'm guessing it has to do with how I specify the features, but I'm not sure how in the feature specification to state that there are multiple examples.</p>

<p>In other words, my attempt of using something similar to:</p>

<pre><code>reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
features = tf.parse_example(serialized_example, features={
    'image_raw': tf.FixedLenFeature([], tf.string),
    'label': tf.FixedLenFeature([], tf.int64),
})
</code></pre>

<p>isn't working, and I assume it's because the features aren't expecting multiple examples at once (but again, I'm not sure). [This results in an error of <code>ValueError: Shape () must have rank 1</code>]</p>

<p>Is this the proper way to read all the records at once? And if so, what do I need to change to actually read the records? Thank you much!</p>