📌  相关文章
📜  将 tfrecord 分成多个 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:14.779000             🧑  作者: Mango

代码示例1
import tensorflow as tf

raw_dataset = tf.data.TFRecordDataset("input_file.tfrecord")

shards = 10

for i in range(shards):
    writer = tf.data.experimental.TFRecordWriter(f"output_file-part-{i}.tfrecord")
    writer.write(raw_dataset.shard(shards, i))