class_docstr: Representative dataset saver in TFRecord format.
  
  Saves representative datasets for quantization calibration in TFRecord format.
  The samples are serialized as `RepresentativeDataSample`.
  
  The `save` method return a signature key to `RepresentativeDatasetFile` map,
  which can be used for QuantizationOptions.
  
  Example usage:
  
  ```python
  # Creating the representative dataset.
  representative_dataset = [{"input": tf.random.uniform(shape=(3, 3))}
                        for _ in range(256)]
  
  # Saving to a TFRecord file.
  dataset_file_map = (
    tf.quantization.experimental.TfRecordRepresentativeDatasetSaver(
          path_map={'serving_default': '/tmp/representative_dataset_path'}
      ).save({'serving_default': representative_dataset})
  )
  
  # Using in QuantizationOptions.
  quantization_options = tf.quantization.experimental.QuantizationOptions(
      signature_keys=['serving_default'],
      representative_datasets=dataset_file_map,
  )
  tf.quantization.experimental.quantize_saved_model(
      '/tmp/input_model',
      '/tmp/output_model',
      quantization_options=quantization_options,
  )
  ```
class_docstr_tok: ["Representative","dataset","saver","in","TFRecord","format",".","Saves","representative","datasets","for","quantization","calibration","in","TFRecord","format",".","The","samples","are","serialized","as","`","RepresentativeDataSample","`",".","The","`","save","`","method","return","a","signature","key","to","`","RepresentativeDatasetFile","`","map",",","which","can","be","used","for","QuantizationOptions",".","Example","usage",":","``","`","python","#","Creating","the","representative","dataset",".","representative_dataset","=","[","{","``","input","''",":","tf.random.uniform","(","shape=","(","3",",","3",")",")","}","for","_","in","range","(","256",")","]","#","Saving","to","a","TFRecord","file",".","dataset_file_map","=","(","tf.quantization.experimental.TfRecordRepresentativeDatasetSaver","(","path_map=","{","'serving_default","'",":","'\/tmp\/representative_dataset_path","'","}",")",".save","(","{","'serving_default","'",":","representative_dataset","}",")",")","#","Using","in","QuantizationOptions",".","quantization_options","=","tf.quantization.experimental.QuantizationOptions","(","signature_keys=","[","'serving_default","'","]",",","representative_datasets=dataset_file_map",",",")","tf.quantization.experimental.quantize_saved_model","(","'\/tmp\/input_model","'",",","'\/tmp\/output_model","'",",","quantization_options=quantization_options",",",")","``","`"]
docstr: Initializes TFRecord represenatative dataset saver.
  
  Args:
    path_map: Signature def key -> path mapping. Each path is a TFRecord file
      to which a `RepresentativeDataset` is saved. The signature def keys
      should be a subset of the `SignatureDef` keys of the
      `representative_dataset` argument of the `save()` call.
docstr_tok: ["Initializes","TFRecord","represenatative","dataset","saver",".","Args",":","path_map",":","Signature","def","key","-",">","path","mapping",".","Each","path","is","a","TFRecord","file","to","which","a","`","RepresentativeDataset","`","is","saved",".","The","signature","def","keys","should","be","a","subset","of","the","`","SignatureDef","`","keys","of","the","`","representative_dataset","`","argument","of","the","`","save","(",")","`","call","."]
code: def __init__(self, path_map: Mapping[str, os.PathLike[str]]):
      """Initializes TFRecord represenatative dataset saver.
  
      Args:
        path_map: Signature def key -> path mapping. Each path is a TFRecord file
          to which a `RepresentativeDataset` is saved. The signature def keys
          should be a subset of the `SignatureDef` keys of the
          `representative_dataset` argument of the `save()` call.
      """
      self.path_map: Mapping[str, os.PathLike[str]] = path_map
  
imports: import collections.abc
  import os
  from typing import Iterable, Mapping, Optional, Union
  import numpy
  from tensorflow.compiler.mlir.quantization.tensorflow import quantization_options_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.client import session
  from tensorflow.python.data.ops import readers
  from tensorflow.python.eager import context
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.lib.io import python_io
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.types import core
  from tensorflow.python.util import tf_export
label_desc: Use image node_id 1 to create a new TfRecordRepresentativeDatasetSaver object from inherited base classes: RepresentativeDatasetSaver with example: obj = TfRecordRepresentativeDatasetSaver(path_map)