class_docstr: Quantize weights while preserving clusters.
docstr: Apply cluster preserved quantization to the input tensor.
  
  Args:
    inputs: Input tensor (layer's weights) to be quantized.
    training: Whether the graph is currently training.
    weights: Dictionary of weights (params) the quantizer can use to
      quantize the tensor (layer's weights). This contains the weights
      created in the `build` function.
    **kwargs: Additional variables which may be passed to the quantizer.
  Returns:
    quantized tensor.
code: def __call__(self, inputs, training, weights, **kwargs):
      """Apply cluster preserved quantization to the input tensor.
  
      Args:
        inputs: Input tensor (layer's weights) to be quantized.
        training: Whether the graph is currently training.
        weights: Dictionary of weights (params) the quantizer can use to
          quantize the tensor (layer's weights). This contains the weights
          created in the `build` function.
        **kwargs: Additional variables which may be passed to the quantizer.
      Returns:
        quantized tensor.
      """
      if training:
          if CLUSTER_CENTROIDS in weights:
              if self.preserve_sparsity:
                  weights[ORIGINAL_WEIGHTS].assign(
                      tf.multiply(
                          weights[ORIGINAL_WEIGHTS],
                          weights[SPARSITY_MASK],
                      )
                  )
                  weights[CLUSTERING_IMPL].cluster_centroids.assign(
                      weights[CLUSTERING_IMPL].cluster_centroids
                      * weights[CENTROIDS_MASK]
                  )
                  weights[CLUSTER_CENTROIDS].assign(
                      weights[CLUSTERING_IMPL].cluster_centroids
                  )
              # Insert clustering variables
              weights[PULLING_INDICES].assign(
                  tf.dtypes.cast(
                      weights[CLUSTERING_IMPL].get_pulling_indices(
                          weights[ORIGINAL_WEIGHTS]
                      ),
                      weights[PULLING_INDICES].dtype,
                  )
              )
  
              output = weights[CLUSTERING_IMPL].get_clustered_weight(
                  weights[PULLING_INDICES], weights[ORIGINAL_WEIGHTS]
              )
              inputs.assign(output)
          else:
              if self.preserve_sparsity:
                  inputs = tf.multiply(inputs, weights[SPARSITY_MASK])
              output = inputs
      else:
          output = inputs
  
      return quant_ops.LastValueQuantize(
          output,
          weights["min_var"],
          weights["max_var"],
          is_training=training,
          num_bits=self.num_bits,
          per_channel=self.per_axis,
          symmetric=self.symmetric,
          narrow_range=self.narrow_range,
      )
  
imports: import logging
  import warnings
  import tensorflow
  from tensorflow_model_optimization.python.core.clustering.keras import cluster_config
  from tensorflow_model_optimization.python.core.clustering.keras import clustering_registry
  from tensorflow_model_optimization.python.core.quantization.keras import quant_ops
  from tensorflow_model_optimization.python.core.quantization.keras import quantizers
  from tensorflow_model_optimization.python.core.quantization.keras.default_8bit import default_8bit_quantize_registry
  from tensorflow_model_optimization.python.core.quantization.keras.default_8bit import default_8bit_quantizers
label_desc: Use image node_id 4 for calling the ClusterPreserveDefaultWeightsQuantizer obj's underlying member method code with example usage: obj.__call__(inputs, training, weights) and returns: quant_ops