@@ -81,7 +81,7 @@ def cluster_weights(to_cluster,
8181 clustering_params = {
8282 'number_of_clusters': 8,
8383 'cluster_centroids_init':
84- cluster_config. CentroidInitialization.DENSITY_BASED
84+ CentroidInitialization.DENSITY_BASED
8585 }
8686
8787 clustered_model = cluster_weights(original_model, **clustering_params)
@@ -93,7 +93,7 @@ def cluster_weights(to_cluster,
9393 clustering_params = {
9494 'number_of_clusters': 8,
9595 'cluster_centroids_init':
96- cluster_config. CentroidInitialization.DENSITY_BASED
96+ CentroidInitialization.DENSITY_BASED
9797 }
9898
9999 model = keras.Sequential([
@@ -108,17 +108,8 @@ def cluster_weights(to_cluster,
108108 number_of_clusters: the number of cluster centroids to form when
109109 clustering a layer/model. For example, if number_of_clusters=8 then only
110110 8 unique values will be used in each weight array.
111- cluster_centroids_init: enum value that determines how the cluster
112- centroids will be initialized.
113- Can have following values:
114- 1. RANDOM : centroids are sampled using the uniform distribution
115- between the minimum and maximum weight values in a given layer
116- 2. DENSITY_BASED : density-based sampling. First, cumulative
117- distribution function is built for weights, then y-axis is evenly
118- spaced into number_of_clusters regions. After this the corresponding x
119- values are obtained and used to initialize clusters centroids.
120- 3. LINEAR : cluster centroids are evenly spaced between the minimum
121- and maximum values of a given weight
111+ cluster_centroids_init: `tfmot.clustering.keras.CentroidInitialization`
112+ instance that determines how the cluster centroids will be initialized.
122113 **kwargs: Additional keyword arguments to be passed to the keras layer.
123114 Ignored when to_cluster is not a keras layer.
124115
0 commit comments