code: def InputExtractor(
      eval_config: config_pb2.EvalConfig,
  ) -> extractor.Extractor:
      """Creates an extractor for extracting features, labels, and example weights.
  
      The extractor's PTransform parses tf.train.Example protos stored under the
      tfma.INPUT_KEY in the incoming extracts and adds the resulting features,
      labels, and example weights to the extracts under the keys tfma.FEATURES_KEY,
      tfma.LABELS_KEY, and tfma.EXAMPLE_WEIGHTS_KEY. If the eval_config contains a
      prediction_key and a corresponding key is found in the parse example, then
      predictions will also be extracted and stored under the tfma.PREDICTIONS_KEY.
      Any extracts that already exist will be merged with the values parsed by this
      extractor with this extractor's values taking precedence when duplicate keys
      are detected.
  
      Note that the use of a prediction_key in an eval_config serves two use cases:
        (1) as a key into the dict of predictions output by predict extractor
        (2) as the key for a pre-computed prediction stored as a feature.
      The InputExtractor can be used to handle case (2). These cases are meant to be
      exclusive (i.e. if approach (2) is used then a predict extractor would not be
      configured and if (1) is used then a key matching the predictons would not be
      stored in the features). However, if a feature key happens to match the same
      name as the prediction output key then both paths may be executed. In this
      case, the value stored here will be replaced by the predict extractor (though
      it will still be popped from the features).
  
      Args:
        eval_config: Eval config.
  
      Returns:
        Extractor for extracting features, labels, and example weights inputs.
      """
      # pylint: disable=no-value-for-parameter
      return extractor.Extractor(
          stage_name=_INPUT_EXTRACTOR_STAGE_NAME,
          ptransform=_ExtractInputs(eval_config=eval_config),
      )
  
file_path: model-analysis/tensorflow_model_analysis/extractors/legacy_input_extractor.py
imports: import copy
  from typing import Any, Dict, List, Optional, Tuple, Union
  import apache_beam
  import numpy
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.extractors import extractor
  from tensorflow_model_analysis.proto import config_pb2
  from tfx_bsl.coders import example_coder
label_desc: Use image node_id 1 for calling a global function with example usage: InputExtractor(eval_config) and returns: extractor