code: def testEvaluateMultiLabelsPredictions(self):
      # Test case where we have multiple labels/predictions
      # Have 6 labels of values 3, 5, 23, 12, 16, 31 and
      # 6 predictions of values 2, 2, 2, 4, 4, 4
      # This should give sum = 108 and mean = 9.
  
      examples = [
          self._makeExample(
              age=1.0, prediction=2, prediction_2=4, label=3, label_2=5
          ),
          self._makeExample(
              age=1.0,
              prediction=2,
              prediction_2=4,
              label=23,
              label_2=12,
          ),
          self._makeExample(
              age=1.0,
              prediction=2,
              prediction_2=4,
              label=16,
              label_2=31,
          ),
      ]
      serialized_examples = [e.SerializeToString() for e in examples]
  
      # Set up a model agnostic config so we can get the FPLConfig.
      feature_map = {
          "age": tf.io.FixedLenFeature([], tf.float32),
          "prediction": tf.io.FixedLenFeature([], tf.int64),
          "prediction_2": tf.io.FixedLenFeature([], tf.int64),
          "label": tf.io.FixedLenFeature([], tf.int64),
          "label_2": tf.io.FixedLenFeature([], tf.int64),
      }
  
      model_agnostic_config = agnostic_predict.ModelAgnosticConfig(
          label_keys=["label", "label_2"],
          prediction_keys=["prediction", "prediction_2"],
          feature_spec=feature_map,
      )
  
      # Create a Model Anostic Evaluate graph handler and feed in the FPL list.
      evaluate_graph = (
          model_agnostic_evaluate_graph.ModelAgnosticEvaluateGraph(
              [add_mean_callback], model_agnostic_config
          )
      )
      evaluate_graph.metrics_reset_update_get_list(serialized_examples)
      outputs = evaluate_graph.get_metric_values()
  
      # Verify that we got the right metrics out.
      self.assertEqual(2, len(outputs))
      self.assertEqual(outputs["tf_metric_mean"], 9.0)
      self.assertEqual(outputs["py_func_total_label"], 108.0)
  
file_path: model-analysis/tensorflow_model_analysis/model_agnostic_eval/model_agnostic_evaluate_graph_test.py
imports: import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  from tensorflow_model_analysis.api import model_eval_lib
  from tensorflow_model_analysis.api import tfma_unit
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.evaluators import legacy_metrics_and_plots_evaluator
  from tensorflow_model_analysis.extractors import slice_key_extractor
  from tensorflow_model_analysis.model_agnostic_eval import model_agnostic_evaluate_graph
  from tensorflow_model_analysis.model_agnostic_eval import model_agnostic_extractor
  from tensorflow_model_analysis.model_agnostic_eval import model_agnostic_predict
  from tensorflow_model_analysis.slicer import slicer_lib
label_desc: Use image node_id 2 for calling the ModelAgnosticEvaluateGraphTest obj's underlying member method code with example usage: obj.testEvaluateMultiLabelsPredictions() without return types