docstr: Test model with a custom clusterable layer derived from Dense.
  
  This customerable layer (see MyDenseLayer definition above) provides the
  function get_clusterable_weights() so that both 'kernel' weights as well
  as 'bias' weights are clustered.
docstr_tok: ["Test","model","with","a","custom","clusterable","layer","derived","from","Dense",".","This","customerable","layer","(","see","MyDenseLayer","definition","above",")","provides","the","function","get_clusterable_weights","(",")","so","that","both","'kernel","'","weights","as","well","as","'bias","'","weights","are","clustered","."]
code: def testMnistMyDenseLayer(self):
      """Test model with a custom clusterable layer derived from Dense.
  
      This customerable layer (see MyDenseLayer definition above) provides the
      function get_clusterable_weights() so that both 'kernel' weights as well
      as 'bias' weights are clustered.
      """
      model = _build_model()
      _train_model(model)
  
      # Checks that number of original weights('kernel') is greater than
      # the number of clusters
      nr_of_unique_weights = _get_number_of_unique_weights(
          model, -1, "kernel"
      )
      self.assertGreater(nr_of_unique_weights, NUMBER_OF_CLUSTERS)
  
      # Checks that number of original weights('bias') is greater than
      # the number of clusters
      nr_of_unique_weights = _get_number_of_unique_weights(
          model, -1, "bias"
      )
      self.assertGreater(nr_of_unique_weights, NUMBER_OF_CLUSTERS)
  
      _, (x_test, y_test) = _get_dataset()
  
      results_original = model.evaluate(x_test, y_test)
      self.assertGreater(results_original[1], 0.8)
  
      clustered_model = _cluster_model(model, NUMBER_OF_CLUSTERS)
  
      results = clustered_model.evaluate(x_test, y_test)
  
      self.assertGreater(results[1], 0.8)
  
      # checks 'kernel' weights of the last layer: MyDenseLayer
      nr_of_unique_weights = _get_number_of_unique_weights(
          clustered_model, -1, "kernel"
      )
      self.assertLessEqual(nr_of_unique_weights, NUMBER_OF_CLUSTERS)
  
      # checks 'bias' weights of the last layer: MyDenseLayer
      nr_of_unique_weights = _get_number_of_unique_weights(
          clustered_model, -1, "bias"
      )
      self.assertLessEqual(nr_of_unique_weights, NUMBER_OF_CLUSTERS)
  
imports: 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 import clusterable_layer
  from tensorflow_model_optimization.python.core.clustering.keras import clustering_algorithm
label_desc: Use image node_id 1 for calling the FunctionalTest obj's underlying member method code with example usage: obj.testMnistMyDenseLayer() without return types