code: def cluster_train_eval_strip(
      model, x_train, y_train, x_test, y_test, batch_size, test_case
  ):
      """Train, evaluate and strip clustering."""
      model = cluster.cluster_weights(
          model,
          number_of_clusters=16,
          cluster_centroids_init=cluster_config.CentroidInitialization.KMEANS_PLUS_PLUS,
      )
  
      model.compile(
          loss="binary_crossentropy",
          optimizer="adam",
          metrics=["accuracy"],
      )
  
      print("Train...")
      model.fit(
          x_train,
          y_train,
          batch_size=batch_size,
          epochs=1,
          validation_data=(x_test, y_test),
          verbose=2,
      )
      score, acc = model.evaluate(x_test, y_test, batch_size=batch_size)
  
      print("Test score:", score)
      print("Test accuracy:", acc)
  
      print("Strip clustering wrapper...")
      model = cluster.strip_clustering(model)
      if "Bidirectional" in test_case:
          layer_weight = getattr(
              model.layers[1].forward_layer.cell, "kernel"
          )
      elif "StackedRNNCells" in test_case:
          layer_weight = getattr(
              model.layers[1].cell.cells[0], "kernel"
          )
      else:
          raise ValueError(
              "Only Bidirectional and StackedRNNCells are tested now."
          )
      print(
          "Number of clusters:",
          len(set(layer_weight.numpy().flatten())),
      )
  
imports: from __future__ import print_function
  import tensorflow
  from tensorflow_model_optimization.python.core.clustering.keras import cluster
  from tensorflow_model_optimization.python.core.clustering.keras import cluster_config
label_desc: Use image node_id 2 for calling a global function with example usage: cluster_train_eval_strip(model, x_train, y_train, x_test, y_test, batch_size, test_case) without return types