code: def FeaturesExtractor(  # pylint: disable=invalid-name
      eval_config: config_pb2.EvalConfig,
      tensor_representations: Optional[
          Mapping[Text, schema_pb2.TensorRepresentation]
      ] = None,
  ) -> extractor.Extractor:
      """Creates an extractor for extracting features.
  
      The extractor acts as follows depending on the existence of certain keys
      within the incoming extracts:
  
        1) Extracts contains tfma.ARROW_RECORD_BATCH_KEY
  
        The features stored in the RecordBatch will be extracted and added to the
        output extract under the key tfma.FEATURES_KEY and the raw serialized inputs
        will be added under the tfma.INPUT_KEY. Any extracts that already exist will
        be merged with the values from the RecordBatch with the RecordBatch values
        taking precedence when duplicate keys are detected. The
        tfma.ARROW_RECORD_BATCH_KEY key will be removed from the output extracts.
  
        2) Extracts contains tfma.FEATURES_KEY (but not tfma.ARROW_RECORD_BATCH_KEY)
  
        The operation will be a no-op and the incoming extracts will be passed as is
        to the output.
  
        3) Extracts contains neither tfma.FEATURES_KEY | tfma.ARROW_RECORD_BATCH_KEY
  
        An exception will be raised.
  
      Args:
        eval_config: Eval config.
        tensor_representations: Optional tensor representations to use when parsing
          the data. If tensor_representations are not passed or a representation is
          not found for a given feature name a default representation will be used
          where possible, otherwise an exception will be raised.
  
      Returns:
        Extractor for extracting features.
      """
      del eval_config
      # pylint: disable=no-value-for-parameter
      return extractor.Extractor(
          stage_name=_FEATURES_EXTRACTOR_STAGE_NAME,
          ptransform=_ExtractFeatures(tensor_representations or {}),
      )
  
file_path: model-analysis/tensorflow_model_analysis/extractors/features_extractor.py
imports: import copy
  from typing import Mapping, Optional, Text, Tuple
  import apache_beam
  import numpy
  import pyarrow
  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 util
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: FeaturesExtractor(eval_config, tensor_representations) and returns: extractor