"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "c5e892cb3ef21b4ba315389210205b65e46b62aa"
Commit ceacd37c authored by Jaehong Kim's avatar Jaehong Kim Committed by A. Unique TensorFlower
Browse files

Remove extra fake-quants near by UpSampling2D for the object detection model.

PiperOrigin-RevId: 468273564
parent 3f1ca33a
...@@ -130,7 +130,9 @@ def _clone_function_for_fpn(layer): ...@@ -130,7 +130,9 @@ def _clone_function_for_fpn(layer):
return tfmot.quantization.keras.quantize_annotate_layer( return tfmot.quantization.keras.quantize_annotate_layer(
qat_nn_layers.BatchNormalizationWrapper(layer), qat_nn_layers.BatchNormalizationWrapper(layer),
qat_configs.Default8BitOutputQuantizeConfig()) qat_configs.Default8BitOutputQuantizeConfig())
return layer if isinstance(layer, tf.keras.layers.UpSampling2D):
return layer
return tfmot.quantization.keras.quantize_annotate_layer(layer)
def build_qat_retinanet( def build_qat_retinanet(
...@@ -174,7 +176,7 @@ def build_qat_retinanet( ...@@ -174,7 +176,7 @@ def build_qat_retinanet(
decoder, decoder,
clone_function=_clone_function_for_fpn, clone_function=_clone_function_for_fpn,
) )
decoder = tfmot.quantization.keras.quantize_model(decoder) decoder = tfmot.quantization.keras.quantize_apply(decoder)
decoder = tfmot.quantization.keras.remove_input_range(decoder) decoder = tfmot.quantization.keras.remove_input_range(decoder)
head = model.head head = model.head
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment