code: def PredictExtractor(  # pylint: disable=invalid-name
      eval_shared_model: types.MaybeMultipleEvalSharedModels,
      desired_batch_size: Optional[int] = None,
      materialize: Optional[bool] = True,
      eval_config: Optional[config_pb2.EvalConfig] = None,
  ) -> extractor.Extractor:
      """Creates an Extractor for TFMAPredict.
  
      The extractor's PTransform loads and runs the eval_saved_model against every
      example yielding a copy of the Extracts input with an additional extract
      of type FeaturesPredictionsLabels keyed by
      tfma.FEATURES_PREDICTIONS_LABELS_KEY unless eval_config is not None in which
      case the features, predictions, and labels will be stored separately under
      tfma.FEATURES_KEY, tfma.PREDICTIONS_KEY, and tfma.LABELS_KEY respectively.
  
      Args:
        eval_shared_model: Shared model (single-model evaluation) or list of shared
          models (multi-model evaluation).
        desired_batch_size: Optional batch size for batching in Aggregate.
        materialize: True to call the FeatureExtractor to add MaterializedColumn
          entries for the features, predictions, and labels.
        eval_config: Eval config.
  
      Returns:
        Extractor for extracting features, predictions, labels, and other tensors
        during predict.
      """
      eval_shared_models = (
          model_util.verify_and_update_eval_shared_models(
              eval_shared_model
          )
      )
  
      # pylint: disable=no-value-for-parameter
      return extractor.Extractor(
          stage_name=_PREDICT_EXTRACTOR_STAGE_NAME,
          ptransform=_TFMAPredict(
              eval_shared_models={
                  m.model_name: m for m in eval_shared_models
              },
              desired_batch_size=desired_batch_size,
              materialize=materialize,
              eval_config=eval_config,
          ),
      )
  
imports: import collections
  import copy
  from typing import Any, Dict, List, Optional, Sequence
  import apache_beam
  import numpy
  import pyarrow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import constants
  from tensorflow_model_analysis.extractors import extractor
  from tensorflow_model_analysis.extractors import legacy_feature_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: PredictExtractor(eval_shared_model, desired_batch_size, materialize, eval_config) and returns: extractor