代码

files = tf.data.Dataset.list_files("your tf records")
dataset = tf.data.TFRecordDataset(files, num_parallel_reads=32)

dataset = dataset.batch(2).map(parse_fn)

iterator = dataset.make_one_shot_iterator()
features = iterator.get_next()

参考