Answers for "divide tfrecord into multiple"

0

divide tfrecord into multiple

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))
Posted by: Guest on March-02-2020

Code answers related to "divide tfrecord into multiple"

Browse Popular Code Answers by Language