Commit 5d6212c8 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 0aa2134f
......@@ -130,7 +130,9 @@ def _clone_function_for_fpn(layer):
return tfmot.quantization.keras.quantize_annotate_layer(
qat_nn_layers.BatchNormalizationWrapper(layer),
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(
......@@ -174,7 +176,7 @@ def build_qat_retinanet(
decoder,
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)
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