code: def _log_sample_num_for_calibration(
      representative_dataset: rd.RepresentativeDataset,
  ) -> rd.RepresentativeDataset:
      """Logs the sample number for calibration.
  
      If in debug logging level, the "sample number / total num samples" is logged
      for every 5 iterations.
  
      This is often useful when tracking the progress of the calibration step which
      is often slow and may look stale if there's no logs being printed.
  
      Args:
        representative_dataset: The representative dataset.
  
      Yields:
        The representative samples from `representative_dataset` without any
        modification.
      """
      num_samples: Optional[int] = rd.get_num_samples(
          representative_dataset
      )
      if num_samples is None:
          total_num_samples = "?"
          logging.info("Representative dataset size unknown.")
      else:
          total_num_samples = str(num_samples)
          logging.info(
              "Using representative dataset of size: %s",
              total_num_samples,
          )
  
      sample_num = 0
      for sample in representative_dataset:
          sample_num += 1
  
          # Log the sample number for every 5 iterations.
          logging.log_every_n(
              logging.DEBUG,
              "Running representative sample for calibration: %d / %s",
              5,
              sample_num,
              total_num_samples,
          )
          yield sample
  
      logging.info(
          "Running representative samples complete: %d / %s",
          sample_num,
          total_num_samples,
      )
  
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 6 for calling a global function with example usage: _log_sample_num_for_calibration(representative_dataset) without return types