class_docstr: TFT benchmark base class.
class_docstr_tok: ["TFT","benchmark","base","class","."]
docstr: Benchmark RunMetaGraphDoFn at the TF level for TFT's TF1 implementation.
  
  Benchmarks the parts of RunMetaGraphDoFn that involve feeding and
  fetching from the TFT SavedModel. Records the wall time taken.
  
  Note that this benchmark necessarily duplicates code directly from TFT
  since it's benchmarking the low-level internals of TFT, which are not
  exposed for use in this way.
docstr_tok: ["Benchmark","RunMetaGraphDoFn","at","the","TF","level","for","TFT","'s","TF1","implementation",".","Benchmarks","the","parts","of","RunMetaGraphDoFn","that","involve","feeding","and","fetching","from","the","TFT","SavedModel",".","Records","the","wall","time","taken",".","Note","that","this","benchmark","necessarily","duplicates","code","directly","from","TFT","since","it","'s","benchmarking","the","low-level","internals","of","TFT",",","which","are","not","exposed","for","use","in","this","way","."]
code: def benchmarkRunMetagraphDoFnAtTFLevel(self):
      """Benchmark RunMetaGraphDoFn at the TF level for TFT's TF1 implementation.
  
      Benchmarks the parts of RunMetaGraphDoFn that involve feeding and
      fetching from the TFT SavedModel. Records the wall time taken.
  
      Note that this benchmark necessarily duplicates code directly from TFT
      since it's benchmarking the low-level internals of TFT, which are not
      exposed for use in this way.
      """
      common_variables = _get_common_variables(
          self._dataset, force_tf_compat_v1=True
      )
      tf_config = (
          tft_beam_impl._FIXED_PARALLELISM_TF_CONFIG
      )  # pylint: disable=protected-access
  
      # This block copied from _GraphStateCompatV1.__init__
      with tf.compat.v1.Graph().as_default() as graph:
          session = tf.compat.v1.Session(graph=graph, config=tf_config)
          with session.as_default():
              (
                  inputs,
                  outputs,
              ) = saved_transform_io.partially_apply_saved_transform_internal(
                  self._dataset.tft_saved_model_path(
                      force_tf_compat_v1=True
                  ),
                  {},
              )
              session.run(tf.compat.v1.global_variables_initializer())
              session.run(tf.compat.v1.tables_initializer())
              graph.finalize()
          # We ignore the schema, and assume there are no excluded outputs.
          outputs_tensor_keys = sorted(set(outputs.keys()))
          fetches = [outputs[key] for key in outputs_tensor_keys]
          tensor_inputs = graph_tools.get_dependent_inputs(
              graph, inputs, fetches
          )
          input_tensor_keys = sorted(tensor_inputs.keys())
          feed_list = [inputs[key] for key in input_tensor_keys]
          callable_get_outputs = session.make_callable(
              fetches, feed_list=feed_list
          )
  
      batch_size, batched_records = _get_batched_records(
          self._dataset,
          force_tf_compat_v1=True,
          max_num_examples=self._max_num_examples(),
      )
  
      input_tensor_adapter = tensor_adapter.TensorAdapter(
          common_variables.tfxio.TensorAdapterConfig()
      )
  
      # This block copied from _RunMetaGraphDoFn._handle_batch
      start = time.time()
      for batch in batched_records:
          feed_by_name = input_tensor_adapter.ToBatchTensors(
              batch, produce_eager_tensors=False
          )
          feed_list = [feed_by_name[name] for name in input_tensor_keys]
          outputs_list = callable_get_outputs(*feed_list)
          _ = {
              key: value
              for key, value in zip(outputs_tensor_keys, outputs_list)
          }
      end = time.time()
      delta = end - start
  
      self.report_benchmark(
          iters=1,
          wall_time=delta,
          extras={
              "batch_size": batch_size,
              "num_examples": self._dataset.num_examples(
                  limit=self._max_num_examples()
              ),
          },
      )
  
imports: import collections
  import shutil
  import tempfile
  import time
  from absl import logging
  import apache_beam
  from apache_beam.utils import shared
  import tensorflow
  import tensorflow_transform
  from tensorflow_transform import graph_tools
  from tensorflow_transform import impl_helper
  import tensorflow_transform.beam
  from tensorflow_transform.beam import impl
  from tensorflow_transform.saved import saved_transform_io
  from tensorflow_transform.saved import saved_transform_io_v2
  from tensorflow_transform.tf_metadata import dataset_metadata
  from tensorflow_transform.tf_metadata import schema_utils
  import tfx
  from tfx.benchmarks import benchmark_utils
  from tfx.benchmarks import benchmark_base
  from tfx_bsl.coders import example_coder
  from tfx_bsl.tfxio import tensor_adapter
  from tfx_bsl.tfxio import tf_example_record
label_desc: Use image node_id 9 for calling the TFTBenchmarkBase obj's underlying member method code with example usage: obj.benchmarkRunMetagraphDoFnAtTFLevel() without return types