Skip to content

Commit 33a8030

Browse files
committed
Improved the test for non_clusterable_layer that demonstrates that
the layer can be clusterable if weights are not allocated. Change-Id: If26bf41355c380dc564aff5e2309dc502abe91f2
1 parent e0e4c09 commit 33a8030

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tensorflow_model_optimization/python/core/clustering/keras/cluster_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ def testClusterCustomNonClusterableLayer(self):
170170
an exception.
171171
"""
172172
custom_non_clusterable_layer = self.custom_non_clusterable_layer
173-
# We need to build weights before check.
173+
# Once layer is empty with no weights allocated, clustering is supported.
174+
cluster_wrapper.ClusterWeights(custom_non_clusterable_layer,
175+
**self.params)
176+
# We need to build weights before check that clustering is not supported.
174177
custom_non_clusterable_layer.build(input_shape=(10, 10))
175178
with self.assertRaises(ValueError):
176179
cluster_wrapper.ClusterWeights(custom_non_clusterable_layer,

0 commit comments

Comments
 (0)