docstr: Runs CQAT end to end and whole model is quantized.
docstr_tok: ["Runs","CQAT","end","to","end","and","whole","model","is","quantized","."]
code: def testEndToEndClusterPreserve(self):
      """Runs CQAT end to end and whole model is quantized."""
      original_model = tf.keras.Sequential(
          [layers.Dense(5, activation="softmax", input_shape=(10,))]
      )
      clustered_model = cluster.cluster_weights(
          original_model, **self.cluster_params
      )
      self.compile_and_fit(clustered_model)
      clustered_model = cluster.strip_clustering(clustered_model)
      num_of_unique_weights_clustering = (
          self._get_number_of_unique_weights(
              clustered_model, 0, "kernel"
          )
      )
  
      quant_aware_annotate_model = quantize.quantize_annotate_model(
          clustered_model
      )
  
      quant_aware_model = quantize.quantize_apply(
          quant_aware_annotate_model,
          scheme=default_8bit_cluster_preserve_quantize_scheme.Default8BitClusterPreserveQuantizeScheme(),
      )
  
      self.compile_and_fit(quant_aware_model)
      stripped_cqat_model = strip_clustering_cqat(quant_aware_model)
  
      # Check the unique weights of a certain layer of
      # clustered_model and pcqat_model
      num_of_unique_weights_cqat = self._get_number_of_unique_weights(
          stripped_cqat_model, 1, "kernel"
      )
      self.assertAllEqual(
          num_of_unique_weights_clustering, num_of_unique_weights_cqat
      )
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.clustering.keras import cluster
  from tensorflow_model_optimization.python.core.clustering.keras import cluster_config
  from tensorflow_model_optimization.python.core.clustering.keras.experimental import cluster
  from tensorflow_model_optimization.python.core.quantization.keras import quantize
  from tensorflow_model_optimization.python.core.quantization.keras.collab_opts.cluster_preserve import default_8bit_cluster_preserve_quantize_scheme
  from tensorflow_model_optimization.python.core.quantization.keras.collab_opts.cluster_preserve.cluster_utils import strip_clustering_cqat
label_desc: Use image node_id 10 for calling the ClusterPreserveIntegrationTest obj's underlying member method code with example usage: obj.testEndToEndClusterPreserve() without return types