code: def build_parsing_eval_input_receiver_fn(feature_spec, label_key):
      """Builds parsing eval receiver fn that handles sparse labels."""
  
      def eval_input_receiver_fn():
          """An input_fn that expects a serialized tf.Example."""
          # Note it's *required* that the batch size should be variable for TFMA.
          serialized_tf_example = tf.compat.v1.placeholder(
              dtype=tf.string, shape=[None], name="input_example_tensor"
          )
          features = tf.io.parse_example(
              serialized=serialized_tf_example, features=feature_spec
          )
          labels = None if label_key is None else features[label_key]
  
          if isinstance(labels, tf.SparseTensor):
              # This bit here is why a custom eval_input_receiver_fn is specified.
              labels = tf.sparse.to_dense(labels, default_value=-1)
  
          return export.EvalInputReceiver(
              features=features,
              labels=labels,
              receiver_tensors={"examples": serialized_tf_example},
          )
  
      return eval_input_receiver_fn
  
imports: import tensorflow
  from tensorflow import estimator
  from tensorflow_model_analysis.eval_saved_model import export
  from tensorflow_model_analysis.eval_saved_model.example_trainers import util
label_desc: Use image node_id 1 for calling a global function with example usage: build_parsing_eval_input_receiver_fn(feature_spec, label_key) and returns: eval_input_receiver_fn, export