code: def _run_function_for_calibration_eager_mode(
      func: wrap_function.WrappedFunction,
      representative_dataset: rd.RepresentativeDataset,
  ) -> None:
      """Runs the representative dataset through a function for calibration.
  
      NOTE: This is intended to be run in eager mode (TF2).
  
      Args:
        func: The function to run the representative samples through.
        representative_dataset: Representative dataset used for calibration. The
          input keys and input values of the representative samples should match the
          keyword arguments of `func`.
      """
      _, keyword_args = func.structured_input_signature
      sample_validator = _create_sample_validator(
          expected_input_keys=keyword_args.keys()
      )
  
      for sample in map(
          sample_validator,
          _log_sample_num_for_calibration(representative_dataset),
      ):
          # Convert any non-Tensor values from the sample to Tensors.
          # This conversion is required because the model saved in `model_dir` is
          # saved using TF1 SavedModelBuilder, which doesn't save the
          # SavedObjectGraph.
          # TODO(b/236795224): Remove the need for this conversion by keeping the
          # FunctionSpec (object graph) in the SavedModel. Related: b/213406917.
          func_kwargs = _convert_values_to_tf_tensors(sample)
          func(**func_kwargs)
  
imports: from collections.abc import Callable, Collection, Mapping, Sequence
  from typing import Optional
  from absl import logging
  from tensorflow.compiler.mlir.quantization.tensorflow import exported_model_pb2
  from tensorflow.compiler.mlir.quantization.tensorflow import quantization_options_pb2
  from tensorflow.compiler.mlir.quantization.tensorflow.calibrator import calibration_algorithm
  from tensorflow.compiler.mlir.quantization.tensorflow.calibrator import calibration_statistics_pb2
  from tensorflow.compiler.mlir.quantization.tensorflow.calibrator import pywrap_calibration
  from tensorflow.compiler.mlir.quantization.tensorflow.python import pywrap_function_lib
  from tensorflow.compiler.mlir.quantization.tensorflow.python import representative_dataset
  from tensorflow.compiler.mlir.quantization.tensorflow.python import save_model
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.core.protobuf import saver_pb2
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.eager import wrap_function
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_conversion
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.saved_model import load
  from tensorflow.python.saved_model import loader_impl
  from tensorflow.python.trackable import autotrackable
  from tensorflow.python.types import core
label_desc: Use image node_id 10 for calling a global function with example usage: _run_function_for_calibration_eager_mode(func, representative_dataset) without return types