Skip to content

Instantly share code, notes, and snippets.

@adityaiitb
Last active August 27, 2020 14:53
Show Gist options
  • Save adityaiitb/876655b5abb692e56be5e742de6efe00 to your computer and use it in GitHub Desktop.
Save adityaiitb/876655b5abb692e56be5e742de6efe00 to your computer and use it in GitHub Desktop.
Reading a TF record file

Documentation.

import tensorflow as tf

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

for raw_record in raw_dataset.take(1):
    example = tf.train.Example()
    example.ParseFromString(raw_record.numpy())
    print(example)
    print(len(example.features.feature))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment