code: def ExampleWeightsExtractor(
      eval_config: config_pb2.EvalConfig,
  ) -> extractor.Extractor:
      """Creates an extractor for extracting example weights.
  
      The extractor's PTransform uses the config's ModelSpec.example_weight_key(s)
      to lookup the associated example weight values stored as features under the
      tfma.FEATURES_KEY (and optionally tfma.TRANSFORMED_FEATURES_KEY) in extracts.
      The resulting values are then added to the extracts under the key
      tfma.EXAMPLE_WEIGHTS_KEY.
  
      Args:
        eval_config: Eval config.
  
      Returns:
        Extractor for extracting example weights.
      """
      # pylint: disable=no-value-for-parameter
      return extractor.Extractor(
          stage_name=_EXAMPLE_WEIGHTS_EXTRACTOR_STAGE_NAME,
          ptransform=_ExtractExampleWeights(eval_config=eval_config),
      )
  
file_path: model-analysis/tensorflow_model_analysis/extractors/example_weights_extractor.py
imports: import copy
  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.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: ExampleWeightsExtractor(eval_config) and returns: extractor