TensorFlow protocol messages – tf.Example

tf.Example is a {‘string':tf.train.Feature} mapping (Python dictionaries), where 'string' could be any name; for example, 'image', 'features', or 'label'.

tf.train.Feature can be one of the following three types:

  • tf.train.BytesList: This is used for string or byte information
  • tf.train.FloatList: This is used for float or double information
  • tf.train.Int64List: This is used for bool, enum, and all kinds of integers, such as int32, uint32, int64, uint64, and so on

tf.Example messages can be serialized, written, and read into tfrecords files by converting standard TensorFlow types using the following shortcut functions:

The functions in the following code block can be used to convert a value into a ...

Get What's New in TensorFlow 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.