class_docstr: Wrapper class for overridden python method definitions.
  
  This class contains python methods that overrides C++ virtual functions
  declared in `pywrap_function_lib.PyFunctionLibrary`.
class_docstr_tok: ["Wrapper","class","for","overridden","python","method","definitions",".","This","class","contains","python","methods","that","overrides","C++","virtual","functions","declared","in","`","pywrap_function_lib.PyFunctionLibrary","`","."]
docstr: Runs calibration and adds calibration statistics to exported model.
  
  Args:
    saved_model_path: Path to the SavedModel to run calibration.
    signature_keys: List of signature keys corresponding to SignatureDefs to
      run calibration on.
    tags: A set of tags that identify the MetaGraphDef.
    calibration_options_serialized: Serialized `CalibrationOptions`.
    force_graph_mode_calibration: If True, runs the calibration in graph mode.
    representative_dataset_file_map_serialized: Signature key ->
      `RepresentativeDatasetFile` mapping for running the calibration step.
      Each dataset file stores the representative dataset for the function
      matching the signature key.
  
  Returns:
    Updated exported model (serialized) where the collected calibration
    statistics are added to `CustomerAggregator` nodes at the `min` and `max`
    attributes.
docstr_tok: ["Runs","calibration","and","adds","calibration","statistics","to","exported","model",".","Args",":","saved_model_path",":","Path","to","the","SavedModel","to","run","calibration",".","signature_keys",":","List","of","signature","keys","corresponding","to","SignatureDefs","to","run","calibration","on",".","tags",":","A","set","of","tags","that","identify","the","MetaGraphDef",".","calibration_options_serialized",":","Serialized","`","CalibrationOptions","`",".","force_graph_mode_calibration",":","If","True",",","runs","the","calibration","in","graph","mode",".","representative_dataset_file_map_serialized",":","Signature","key","-",">","`","RepresentativeDatasetFile","`","mapping","for","running","the","calibration","step",".","Each","dataset","file","stores","the","representative","dataset","for","the","function","matching","the","signature","key",".","Returns",":","Updated","exported","model","(","serialized",")","where","the","collected","calibration","statistics","are","added","to","`","CustomerAggregator","`","nodes","at","the","`","min","`","and","`","max","`","attributes","."]
code: def run_calibration(
      self,
      saved_model_path: str,
      signature_keys: list[str],
      tags: set[str],
      calibration_options_serialized: bytes,
      force_graph_mode_calibration: bool,
      representative_dataset_file_map_serialized: dict[str, bytes],
  ) -> None:
      # LINT.ThenChange(py_function_lib.h:run_calibration)
      """Runs calibration and adds calibration statistics to exported model.
  
      Args:
        saved_model_path: Path to the SavedModel to run calibration.
        signature_keys: List of signature keys corresponding to SignatureDefs to
          run calibration on.
        tags: A set of tags that identify the MetaGraphDef.
        calibration_options_serialized: Serialized `CalibrationOptions`.
        force_graph_mode_calibration: If True, runs the calibration in graph mode.
        representative_dataset_file_map_serialized: Signature key ->
          `RepresentativeDatasetFile` mapping for running the calibration step.
          Each dataset file stores the representative dataset for the function
          matching the signature key.
  
      Returns:
        Updated exported model (serialized) where the collected calibration
        statistics are added to `CustomerAggregator` nodes at the `min` and `max`
        attributes.
      """
      dataset_file_map = {}
      for (
          signature_key,
          dataset_file_serialized,
      ) in representative_dataset_file_map_serialized.items():
          dataset_file_map[
              signature_key
          ] = quantization_options_pb2.RepresentativeDatasetFile.FromString(
              dataset_file_serialized
          )
  
      repr_dataset_map = rd.TfRecordRepresentativeDatasetLoader(
          dataset_file_map=dataset_file_map
      ).load()
  
      # Uses the representative dataset to collect statistics for calibration.
      # After this operation, min & max values are stored separately in a global
      # CalibratorSingleton instance.
      _run_graph_for_calibration(
          saved_model_path,
          signature_keys,
          tags,
          repr_dataset_map,
          force_graph_mode_calibration,
      )
  
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 2 for calling the PyFunctionLibrary obj's underlying member method code with example usage: obj.run_calibration(saved_model_path, signature_keys, tags, calibration_options_serialized, force_graph_mode_calibration, representative_dataset_file_map_serialized) without return types