TFRecordExample

class dragon.io.TFRecordExample[source]

Describe an example of the TFRecord.

__init__

TFRecordExample.__init__()[source]

Create a TFRecordExample.

Methods

add_floats

TFRecordExample.add_floats(
  key,
  value
)[source]

Add a named float feature.

Parameters:
  • key (str) – The unique key.
  • value (Sequence[float]) – A sequence of floats.

add_ints

TFRecordExample.add_ints(
  key,
  value
)[source]

Add a named integer feature.

Parameters:
  • key (str) – The unique key.
  • value (Sequence[int]) – A sequence of integers.

add_strings

TFRecordExample.add_strings(
  key,
  value
)[source]

Add a named string feature.

Parameters:
  • key (str) – The unique key.
  • value (Sequence[bytes]) – A sequence of strings.

serialize_to

TFRecordExample.serialize_to(
  pack_length=True,
  pack_crc32=True
)[source]

Serialize the message to raw bytes.

Parameters:
  • pack_length (bool, optional, default=True) – True to pack with length.
  • pack_crc32 (bool, optional, default=True) – True to pack with crc32.
Returns:

bytes – The serialized message bytes.