class_docstr: TFMA benchmark base class.
class_docstr_tok: ["TFMA","benchmark","base","class","."]
docstr: Benchmark the predict and aggregate combine stages "manually".
  
  Runs _TFMAPredictionDoFn "manually" outside a Beam pipeline. Records the
  wall time taken.
docstr_tok: ["Benchmark","the","predict","and","aggregate","combine","stages","``","manually","''",".","Runs","_TFMAPredictionDoFn","``","manually","''","outside","a","Beam","pipeline",".","Records","the","wall","time","taken","."]
code: def benchmarkPredict(self):
      """Benchmark the predict and aggregate combine stages "manually".
  
      Runs _TFMAPredictionDoFn "manually" outside a Beam pipeline. Records the
      wall time taken.
      """
      # Run InputsToExtracts manually.
      records = []
      for x in self._dataset.read_raw_dataset(
          deserialize=False, limit=self._max_num_examples()
      ):
          records.append({tfma.constants.INPUT_KEY: x})
  
      fn = tfma.extractors.legacy_predict_extractor._TFMAPredictionDoFn(  # pylint: disable=protected-access
          eval_shared_models={
              "": tfma.default_eval_shared_model(
                  eval_saved_model_path=self._dataset.tfma_saved_model_path()
              )
          },
          eval_config=None,
      )
      fn.setup()
  
      # Predict
      predict_batch_size = 1000
      predict_result = []
      start = time.time()
      for batch in benchmark_utils.batched_iterator(
          records, predict_batch_size
      ):
          predict_result.extend(fn.process(batch))
      end = time.time()
      delta = end - start
      self.report_benchmark(
          iters=1,
          wall_time=delta,
          extras={
              "batch_size": predict_batch_size,
              "num_examples": self._dataset.num_examples(
                  limit=self._max_num_examples()
              ),
          },
      )
  
file_path: tfx/tfx/benchmarks/tfma_benchmark_base.py
imports: import time
  import apache_beam
  import tensorflow_model_analysis
  from tensorflow_model_analysis.eval_saved_model import load
  import tfx
  from tfx.benchmarks import benchmark_utils
  from tfx.benchmarks import benchmark_base
label_desc: Use image node_id 5 for calling the TFMABenchmarkBase obj's underlying member method code with example usage: obj.benchmarkPredict() without return types