File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
tensorflow_model_optimization/python/core/clustering/keras Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ def __init__(self,
62
62
'Please initialize `Cluster` layer with a '
63
63
'`Layer` instance. You passed: {input}' .format (input = layer ))
64
64
65
+ if 'name' not in kwargs :
66
+ kwargs ['name' ] = self ._make_layer_name (layer )
67
+
65
68
if isinstance (layer , clusterable_layer .ClusterableLayer ):
66
69
# A user-defined custom layer
67
70
super (ClusterWeights , self ).__init__ (layer , ** kwargs )
@@ -133,6 +136,10 @@ def __init__(self,
133
136
and hasattr (layer , '_batch_input_shape' ):
134
137
self ._batch_input_shape = self .layer ._batch_input_shape
135
138
139
+ @staticmethod
140
+ def _make_layer_name (layer ):
141
+ return '{}_{}' .format ('cluster' , layer .name )
142
+
136
143
@staticmethod
137
144
def _weight_name (name ):
138
145
"""Extracts the weight name from the full TensorFlow variable name.
You can’t perform that action at this time.
0 commit comments