in benchmarking/pipemode_benchmark/recordio_utils.py [0:0]
def validate_record_file(filename, dimension):
"""Confirm that a recordio file has been created properly."""
data = open(filename, 'rb').read()
magic_number, length = struct.unpack('II', data[0:8])
encoded = data[8:8 + length]
features = {
'data': tf.FixedLenFeature([], tf.string),
'labels': tf.FixedLenFeature([], tf.int64),
}
parsed = tf.parse_single_example(encoded, features)
x = tf.decode_raw(parsed['data'], tf.float64)
with tf.Session() as sess:
array = sess.run(x)
assert array.shape[0] == dimension