File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -91,21 +91,24 @@ def get_config(self):
91
91
}
92
92
93
93
# Add quantization support by utilizing `DTypePolicyMap`
94
+ dtype = None
94
95
try :
95
96
if isinstance (
96
97
self .dtype_policy , keras .dtype_policies .DTypePolicyMap
97
98
):
98
- config . update ({ " dtype" : self .dtype_policy })
99
+ dtype = self .dtype_policy
99
100
else :
100
101
policy_map = keras .dtype_policies .DTypePolicyMap ()
101
102
for layer in self ._flatten_layers ():
102
103
if layer .quantization_mode is not None :
103
104
policy_map [layer .path ] = layer .dtype_policy
104
105
if len (policy_map ) > 0 :
105
- config . update ({ " dtype" : policy_map })
106
+ dtype = policy_map
106
107
# Before Keras 3.2, there is no `keras.dtype_policies.get`.
107
108
except AttributeError :
108
- config .update ({"dtype" : None })
109
+ pass
110
+
111
+ config .update ({"dtype" : dtype })
109
112
return config
110
113
111
114
@classmethod
You can’t perform that action at this time.
0 commit comments