From 0ada0a06fcb5e092e34c45d49c324bca277b2ede Mon Sep 17 00:00:00 2001 From: Oliver Maier Date: Fri, 8 Mar 2024 09:06:34 +0100 Subject: [PATCH] Update quantize_layer.py Calling super.build() of the layer to indicate that the layer was built. Previous version did not set the self.built=True flag and would lead to a mismatch between stored and expected weights when loading a .keras model --- .../python/core/quantization/keras/quantize_layer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow_model_optimization/python/core/quantization/keras/quantize_layer.py b/tensorflow_model_optimization/python/core/quantization/keras/quantize_layer.py index 59df68c1c..af71b85b5 100644 --- a/tensorflow_model_optimization/python/core/quantization/keras/quantize_layer.py +++ b/tensorflow_model_optimization/python/core/quantization/keras/quantize_layer.py @@ -54,6 +54,7 @@ def __init__(self, quantizer, **kwargs): self.quantizer = quantizer def build(self, input_shape): + super(QuantizeLayer, self).build(input_shape) if self.quantizer: self.quantizer_vars = self.quantizer.build( input_shape, self.name, self)