code: def testLabelsExtractorMultiOutput(self):
      model_spec = config_pb2.ModelSpec(
          label_keys={
              "output1": "label1",
              "output2": "label2",
              "output3": "label3",
          }
      )
      eval_config = config_pb2.EvalConfig(model_specs=[model_spec])
      feature_extractor = features_extractor.FeaturesExtractor(
          eval_config
      )
      label_extractor = labels_extractor.LabelsExtractor(eval_config)
  
      schema = text_format.Parse(
          """
          feature {
            name: "label1"
            type: FLOAT
          }
          feature {
            name: "label2"
            type: FLOAT
          }
          feature {
            name: "fixed_int"
            type: INT
          }
          """,
          schema_pb2.Schema(),
      )
      tfx_io = test_util.InMemoryTFExampleRecord(
          schema=schema,
          raw_record_column_name=constants.ARROW_INPUT_COLUMN,
      )
  
      examples = [
          self._makeExample(label1=1.0, label2=0.0, fixed_int=1),
          self._makeExample(label1=1.0, label2=1.0, fixed_int=1),
      ]
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          result = (
              pipeline
              | "Create"
              >> beam.Create(
                  [e.SerializeToString() for e in examples],
                  reshuffle=False,
              )
              | "BatchExamples" >> tfx_io.BeamSource(batch_size=2)
              | "InputsToExtracts"
              >> model_eval_lib.BatchedInputsToExtracts()
              | feature_extractor.stage_name
              >> feature_extractor.ptransform
              | label_extractor.stage_name >> label_extractor.ptransform
          )
  
          # pylint: enable=no-value-for-parameter
  
          def check_result(got):
              try:
                  self.assertLen(got, 1)
                  # None cannot be compared with assertAllClose
                  self.assertIn("output3", got[0][constants.LABELS_KEY])
                  self.assertIsNone(
                      got[0][constants.LABELS_KEY]["output3"]
                  )
                  del got[0][constants.LABELS_KEY]["output3"]
                  self.assertAllClose(
                      got[0][constants.LABELS_KEY],
                      {
                          "output1": np.array([[1.0], [1.0]]),
                          "output2": np.array([[0.0], [1.0]]),
                      },
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(result, check_result, label="result")
  
file_path: model-analysis/tensorflow_model_analysis/extractors/labels_extractor_test.py
imports: from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import model_eval_lib
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.extractors import features_extractor
  from tensorflow_model_analysis.extractors import labels_extractor
  from tensorflow_model_analysis.proto import config_pb2
  from tfx_bsl.tfxio import test_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 2 for calling the LabelsExtractorTest obj's underlying member method code with example usage: obj.testLabelsExtractorMultiOutput() without return types