@@ -61,7 +61,6 @@ def testCannotBeInitializedWithNonLayerObject(self):
61
61
cluster_wrapper .ClusterWeights (
62
62
{'this' : 'is not a Layer instance' },
63
63
number_of_clusters = 13 ,
64
- cluster_centroids_init = CentroidInitialization .LINEAR
65
64
)
66
65
67
66
def testCannotBeInitializedWithNonClusterableLayer (self ):
@@ -70,15 +69,13 @@ def testCannotBeInitializedWithNonClusterableLayer(self):
70
69
cluster_wrapper .ClusterWeights (
71
70
NonClusterableLayer (10 ),
72
71
number_of_clusters = 13 ,
73
- cluster_centroids_init = CentroidInitialization .LINEAR
74
72
)
75
73
76
74
def testCanBeInitializedWithClusterableLayer (self ):
77
75
"""Verifies that ClusterWeights can be initialized with a built-in clusterable layer."""
78
76
l = cluster_wrapper .ClusterWeights (
79
77
layers .Dense (10 ),
80
78
number_of_clusters = 13 ,
81
- cluster_centroids_init = CentroidInitialization .LINEAR
82
79
)
83
80
self .assertIsInstance (l , cluster_wrapper .ClusterWeights )
84
81
@@ -87,16 +84,14 @@ def testCannotBeInitializedWithNonIntegerNumberOfClusters(self):
87
84
with self .assertRaises (ValueError ):
88
85
cluster_wrapper .ClusterWeights (
89
86
layers .Dense (10 ),
90
- number_of_clusters = '13' ,
91
- cluster_centroids_init = CentroidInitialization .LINEAR )
87
+ number_of_clusters = '13' )
92
88
93
89
def testCannotBeInitializedWithFloatNumberOfClusters (self ):
94
90
"""Verifies that ClusterWeights cannot be initialized with a decimal value provided for the number of clusters."""
95
91
with self .assertRaises (ValueError ):
96
92
cluster_wrapper .ClusterWeights (
97
93
layers .Dense (10 ),
98
94
number_of_clusters = 13.4 ,
99
- cluster_centroids_init = CentroidInitialization .LINEAR
100
95
)
101
96
102
97
@parameterized .parameters (
@@ -111,7 +106,6 @@ def testCannotBeInitializedWithNumberOfClustersLessThanTwo(
111
106
cluster_wrapper .ClusterWeights (
112
107
layers .Dense (10 ),
113
108
number_of_clusters = number_of_clusters ,
114
- cluster_centroids_init = CentroidInitialization .LINEAR
115
109
)
116
110
117
111
@parameterized .parameters ((0 ), (2 ), (- 32 ))
@@ -122,7 +116,6 @@ def testCannotBeInitializedWithSparsityPreservationAndNumberOfClustersLessThanTh
122
116
cluster_wrapper .ClusterWeights (
123
117
layers .Dense (10 ),
124
118
number_of_clusters = number_of_clusters ,
125
- cluster_centroids_init = CentroidInitialization .LINEAR ,
126
119
preserve_sparsity = True )
127
120
128
121
def testCanBeInitializedWithAlreadyClusterableLayer (self ):
@@ -131,7 +124,6 @@ def testCanBeInitializedWithAlreadyClusterableLayer(self):
131
124
l = cluster_wrapper .ClusterWeights (
132
125
layer ,
133
126
number_of_clusters = 13 ,
134
- cluster_centroids_init = CentroidInitialization .LINEAR
135
127
)
136
128
self .assertIsInstance (l , cluster_wrapper .ClusterWeights )
137
129
@@ -140,7 +132,6 @@ def testIfLayerHasBatchShapeClusterWeightsMustHaveIt(self):
140
132
l = cluster_wrapper .ClusterWeights (
141
133
layers .Dense (10 , input_shape = (10 ,)),
142
134
number_of_clusters = 13 ,
143
- cluster_centroids_init = CentroidInitialization .LINEAR
144
135
)
145
136
self .assertTrue (hasattr (l , '_batch_input_shape' ))
146
137
@@ -183,7 +174,6 @@ def testClusterReassociation(self):
183
174
l = cluster_wrapper .ClusterWeights (
184
175
keras .layers .Dense (8 , input_shape = input_shape ),
185
176
number_of_clusters = 2 ,
186
- cluster_centroids_init = CentroidInitialization .LINEAR
187
177
)
188
178
# Build a layer with the given shape
189
179
l .build (input_shape )
@@ -239,7 +229,6 @@ def testSameWeightsAreReturnedBeforeAndAfterSerialisation(self):
239
229
original_layer = cluster_wrapper .ClusterWeights (
240
230
keras .layers .Dense (8 , input_shape = input_shape ),
241
231
number_of_clusters = 2 ,
242
- cluster_centroids_init = CentroidInitialization .LINEAR
243
232
)
244
233
# Build a layer with the given shape
245
234
original_layer .build (input_shape )
0 commit comments