Skip to main content

No project description provided

Project description

TFReecord

Read & Write TFRecord without heavy Tensorflow.

pip3 install tfreecord

Example

Write TFRecord

import tfreecord

writer = tfreecord.RecordWriter()
feature = {
    'id': writer.int64_feature(759),
    'text': writer.bytes_feature("Now rides our knight".encode("utf-8")),
    'label': writer.bytes_feature("poem".encode("utf-8")),
}

with open("poems.tfrecord", "ab") as f:
    f.write(writer.encode_example(feature))

Read TFRecord

import tfreecord

reader = tfreecord.RecordReader()

for data in reader.read_from_tfrecord("poems.tfrecord"):
    print(data)

Thanks to Jong Wook Kim blog post about TFRecords here and his tfrecord_lite library.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tfreecord-1.0.0.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

tfreecord-1.0.0-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page