From c0c18cf963b82ff5d0b61334585ac9db72ccc1ec Mon Sep 17 00:00:00 2001 From: Guanghua Yu <742925032@qq.com> Date: Tue, 3 Jan 2023 16:14:28 +0800 Subject: [PATCH] fix unsqueeze2+conv2d quantization (#49164) --- .../static/quantization/post_training_quantization.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/paddle/static/quantization/post_training_quantization.py b/python/paddle/static/quantization/post_training_quantization.py index 0ab859998d..f11ae10948 100644 --- a/python/paddle/static/quantization/post_training_quantization.py +++ b/python/paddle/static/quantization/post_training_quantization.py @@ -659,8 +659,12 @@ class PostTrainingQuantization: _logger.warning( op_type + " is not supported for quantization." ) + is_conv1d_quant = (op_type == "unsqueeze2") and ( + utils._get_op_input_var_names(op)[0] + in persistable_var_names + ) # For quantized ops, sample inputs and outputs - if op_type in self._quantizable_op_type: + if op_type in self._quantizable_op_type or is_conv1d_quant: collect_var_name( utils._get_op_input_var_names(op), persistable_var_names, -- GitLab