class_docstr: ABC interface which encapsulates the logic of how to quantize tensors.
  
  This is an experimental API not subject to backward compatibility.
  
  A `Quantizer` is used by the library code to apply the mathematical
  transformations which actually quantize a tensor, hence allowing the user
  precise control over the algorithm with which tensors are quantized. When used
  in conjunction with `QuantizeConfig` it controls how a layer is quantized.
  
  Create a custom quantizer:
  
  ```python
  class FixedRangeQuantizer(Quantizer):
    # Example quantizer which clips tensors in a fixed range.
  
    def build(self, tensor_shape, name, layer):
      range_var = layer.add_weight(
        name + '_range',
        initializer=keras.initializers.Constant(6.0),
        trainable=False)
  
      return {
        'range_var': range_var,
      }
  
    def __call__(self, inputs, training, weights, **kwargs):
      return tf.keras.backend.clip(
          inputs, 0.0, weights['range_var'])
  
    def get_config(self):
      # Not needed. No __init__ parameters to serialize.
      return {}
  ```
  
  For a full example, see
  https://www.tensorflow.org/model_optimization/guide/quantization/training_comprehensive_guide.md
class_docstr_tok: ["ABC","interface","which","encapsulates","the","logic","of","how","to","quantize","tensors",".","This","is","an","experimental","API","not","subject","to","backward","compatibility",".","A","`","Quantizer","`","is","used","by","the","library","code","to","apply","the","mathematical","transformations","which","actually","quantize","a","tensor",",","hence","allowing","the","user","precise","control","over","the","algorithm","with","which","tensors","are","quantized",".","When","used","in","conjunction","with","`","QuantizeConfig","`","it","controls","how","a","layer","is","quantized",".","Create","a","custom","quantizer",":","``","`","python","class","FixedRangeQuantizer","(","Quantizer",")",":","#","Example","quantizer","which","clips","tensors","in","a","fixed","range",".","def","build","(","self",",","tensor_shape",",","name",",","layer",")",":","range_var","=","layer.add_weight","(","name","+","'_range","'",",","initializer=keras.initializers.Constant","(","6.0",")",",","trainable=False",")","return","{","'range_var","'",":","range_var",",","}","def","__call__","(","self",",","inputs",",","training",",","weights",",","*","*","kwargs",")",":","return","tf.keras.backend.clip","(","inputs",",","0.0",",","weights","[","'range_var","'","]",")","def","get_config","(","self",")",":","#","Not","needed",".","No","__init__","parameters","to","serialize",".","return","{","}","``","`","For","a","full","example",",","see","https",":","\/\/www.tensorflow.org\/model_optimization\/guide\/quantization\/training_comprehensive_guide.md"]
docstr: Construct the weights required by the quantizer.
  
  A quantizer may need to construct variables to hold the state for its
  algorithm. This function is invoked during the `build` stage of the layer
  that the quantizer is used for. Any variables constructed are under the
  scope of the `layer` and serialized as part of the layer.
  
  Args:
    tensor_shape: Shape of tensor which needs to be quantized.
    name: Name of tensor.
    layer: Keras layer which is quantizing the tensors. The layer is needed
      to construct the weights, and is also the owner of the weights.
  
  Returns: Dictionary of constructed weights. This dictionary will be
    passed to the quantizer's __call__ function as a `weights` dictionary.
code: def build(self, tensor_shape, name, layer):
      """Construct the weights required by the quantizer.
  
      A quantizer may need to construct variables to hold the state for its
      algorithm. This function is invoked during the `build` stage of the layer
      that the quantizer is used for. Any variables constructed are under the
      scope of the `layer` and serialized as part of the layer.
  
      Args:
        tensor_shape: Shape of tensor which needs to be quantized.
        name: Name of tensor.
        layer: Keras layer which is quantizing the tensors. The layer is needed
          to construct the weights, and is also the owner of the weights.
  
      Returns: Dictionary of constructed weights. This dictionary will be
        passed to the quantizer's __call__ function as a `weights` dictionary.
      """
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import six
  import tensorflow
  from tensorflow_model_optimization.python.core.quantization.keras import quant_ops
label_desc: Use image node_id 1 for calling the Quantizer obj's underlying member method code with example usage: obj.build(tensor_shape, name, layer) without return types