Skip to content

Commit e16d463

Browse files
Xharktensorflower-gardener
authored andcommitted
Creates non-breaking changes where necessary in preparation for switching all of Keras to new serialization format.
PiperOrigin-RevId: 519076347
1 parent 63a113d commit e16d463

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tensorflow_model_optimization/python/core/quantization/keras/quantize_config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,18 @@ def get_config(self):
189189
"""Returns the config used to serialize `QuantizeConfig`."""
190190
raise NotImplementedError('QuantizeConfig should implement get_config().')
191191

192+
@classmethod
193+
def from_config(cls, config):
194+
"""Instantiates a `QuantizeConfig` from its config.
195+
196+
Args:
197+
config: Output of `get_config()`.
198+
199+
Returns:
200+
A `QuantizeConfig` instance.
201+
"""
202+
return cls(**config)
203+
192204

193205
class OutputOnlyConfig(QuantizeConfig):
194206
"""QuantizeConfig that only quantizes output."""

0 commit comments

Comments
 (0)