code: def parse_from_tf_example(
      serialized,
      context_feature_spec=None,
      example_feature_spec=None,
      size_feature_name=None,
      mask_feature_name=None,
  ):
      """Parse function to convert `tf.train.Example` to feature maps.
  
      Args:
        serialized: (`tf.train.Example`) A serialized proto object containing
          context and example features.
        context_feature_spec: (dict) A mapping from feature keys to
          `FixedLenFeature`, `VarLenFeature` or `RaggedFeature` values for context
          in `tf.train.Example` proto.
        example_feature_spec: (dict) A mapping from feature keys to
          `FixedLenFeature`, `VarLenFeature` or `RaggedFeature` values for examples
          in `tf.train.Example` proto.
        size_feature_name: (str) Name of feature for example list sizes. Populates
          the feature dictionary with a `tf.int32` Tensor of shape [batch_size] for
          this feature name. If None, which is default, this feature is not
          generated.
        mask_feature_name: (str) Name of feature for example list masks. Populates
          the feature dictionary with a `tf.bool` Tensor of shape [batch_size,
          list_size] for this feature name. If None, which is default, this feature
          is not generated.
  
      Returns:
        A mapping from feature keys to `Tensor`, `SparseTensor` or `RaggedTensor`.
      """
      batch_size = tf.shape(serialized)[0]
      features = tf.io.parse_example(
          serialized,
          features={**context_feature_spec, **example_feature_spec},
      )
      for feature_key, feature_type in example_feature_spec.items():
          if isinstance(feature_type, tf.io.RaggedFeature):
              features[feature_key] = tf.expand_dims(
                  features[feature_key], axis=1
              )
          else:
              # feature is either a Tensor or SparseTensor.
              features[feature_key] = utils.reshape_first_ndims(
                  features[feature_key], 1, [batch_size, 1]
              )
      if size_feature_name is not None:
          # Populate features with a size feature of value 1, corresponding to only
          # one example per list.
          features[size_feature_name] = tf.ones(shape=[batch_size])
      if mask_feature_name:
          features[mask_feature_name] = tf.sequence_mask(
              tf.ones(shape=[batch_size])
          )
      return features
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import functools
  import six
  import tensorflow
  from tensorflow import estimator
  from google.protobuf import descriptor_pb2
  from tensorflow_ranking.python import utils
label_desc: Use image node_id 15 for calling a global function with example usage: parse_from_tf_example(serialized, context_feature_spec, example_feature_spec, size_feature_name, mask_feature_name) and returns: features