code: def PredictionsExtractor(
      eval_config: config_pb2.EvalConfig,
      eval_shared_model: Optional[
          types.MaybeMultipleEvalSharedModels
      ] = None,
      output_keypath: Sequence[str] = (constants.PREDICTIONS_KEY,),
  ) -> extractor.Extractor:
      """Creates an extractor for performing predictions over a batch.
  
      The extractor's PTransform loads and runs the serving saved_model(s) against
      every Extracts yielding a copy of the incoming Extracts with an additional
      Extracts added for the predictions keyed by tfma.PREDICTIONS_KEY. The model
      inputs are searched for under tfma.FEATURES_KEY (keras only) or tfma.INPUT_KEY
      (if tfma.FEATURES_KEY is not set or the model is non-keras). If multiple
      models are used the predictions will be stored in a dict keyed by model name.
  
      Note that the prediction_key in the ModelSpecs also serves as a key into the
      dict of the prediction's output.
  
      Args:
        eval_config: Eval config.
        eval_shared_model: Shared model (single-model evaluation) or list of shared
          models (multi-model evaluation) or None (predictions obtained from
          features).
        output_keypath: A sequence of keys to be used as the path to traverse and
          insert the outputs in the extract.
  
      Returns:
        Extractor for extracting predictions.
      """
      # TODO(b/239975835): Remove this Optional support for version 1.0.
      if eval_shared_model is None:
          logging.warning(
              "Calling the PredictionsExtractor with eval_shared_model=None is "
              "deprecated and no longer supported. This will break in version 1.0. "
              "Please update your implementation to call "
              "MaterializedPredictionsExtractor directly."
          )
          (
              _,
              ptransform,
          ) = materialized_predictions_extractor.MaterializedPredictionsExtractor(
              eval_config, output_keypath=output_keypath
          )
          # Note we are changing the stage name here for backwards compatibility. Old
          # clients expect these code paths to have the same stage name. New clients
          # should never reference the private stage name.
          return extractor.Extractor(
              stage_name=PREDICTIONS_EXTRACTOR_STAGE_NAME,
              ptransform=ptransform,
          )
  
      return extractor.Extractor(
          stage_name=PREDICTIONS_EXTRACTOR_STAGE_NAME,
          ptransform=_ModelSignaturesInferenceWrapper(  # pylint: disable=no-value-for-parameter
              model_specs=list(eval_config.model_specs),
              eval_shared_model=eval_shared_model,
              output_keypath=output_keypath,
          ),
      )
  
file_path: model-analysis/tensorflow_model_analysis/extractors/predictions_extractor.py
imports: from typing import List, Optional, Sequence
  from absl import logging
  import apache_beam
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.extractors import extractor
  from tensorflow_model_analysis.extractors import materialized_predictions_extractor
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import model_util
label_desc: Use image node_id 1 for calling a global function with example usage: PredictionsExtractor(eval_config, eval_shared_model, output_keypath) and returns: extractor, extractor