code: def _parse_example_proto(example_serialized):
      """Parses an Example proto containing a training example of an image.
  
      The output of the build_image_data.py image preprocessing script is a dataset
      containing serialized Example protocol buffers. Each Example proto contains
      the following fields (values are included as examples):
  
        image/height: 462
        image/width: 581
        image/colorspace: 'RGB'
        image/channels: 3
        image/class/label: 615
        image/class/synset: 'n03623198'
        image/class/text: 'knee pad'
        image/object/bbox/xmin: 0.1
        image/object/bbox/xmax: 0.9
        image/object/bbox/ymin: 0.2
        image/object/bbox/ymax: 0.6
        image/object/bbox/label: 615
        image/format: 'JPEG'
        image/filename: 'ILSVRC2012_val_00041207.JPEG'
        image/encoded: <JPEG encoded string>
  
      Args:
        example_serialized: scalar Tensor tf.string containing a serialized
          Example protocol buffer.
  
      Returns:
        image_buffer: Tensor tf.string containing the contents of a JPEG file.
        label: Tensor tf.int32 containing the label.
        bbox: 3-D float Tensor of bounding boxes arranged [1, num_boxes, coords]
          where each coordinate is [0, 1) and the coordinates are arranged as
          [ymin, xmin, ymax, xmax].
      """
      # Dense features in Example proto.
      feature_map = {
          "image/encoded": tf.io.FixedLenFeature(
              [], dtype=tf.string, default_value=""
          ),
          "image/class/label": tf.io.FixedLenFeature(
              [], dtype=tf.int64, default_value=-1
          ),
          "image/class/text": tf.io.FixedLenFeature(
              [], dtype=tf.string, default_value=""
          ),
      }
      # NOTE(swang): bbox from dataset is not actually used by the reference
      # implementation.
      # https://github.com/mlcommons/training/pull/170
      # sparse_float32 = tf.VarLenFeature(dtype=tf.float32)
      # # Sparse features in Example proto.
      # feature_map.update(
      #     {k: sparse_float32 for k in ['image/object/bbox/xmin',
      #                                  'image/object/bbox/ymin',
      #                                  'image/object/bbox/xmax',
      #                                  'image/object/bbox/ymax']})
  
      features = tf.io.parse_single_example(
          example_serialized, feature_map
      )
      label = tf.cast(features["image/class/label"], dtype=tf.int32)
  
      return features["image/encoded"], label
  
file_path: ray/release/air_tests/air_benchmarks/mlperf-train/tf_utils.py
imports: import tensorflow
  import functools
  import logging
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_example_proto(example_serialized) and returns: features,  label