From ab1abd40df8207b0961f995922f695b5e15b3ca7 Mon Sep 17 00:00:00 2001 From: ceci3 Date: Fri, 21 Jan 2022 10:18:43 +0800 Subject: [PATCH] fix save channel wise quant model (#39054) --- .../paddle/fluid/contrib/slim/quantization/quantization_pass.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py index 645feda21f..efa000274d 100644 --- a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py +++ b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py @@ -1220,6 +1220,8 @@ class QuantizationFreezePass(object): if op_node_desc.has_attr("quantization_type") and \ op_node_desc.attr("quantization_type") == "qat_with_weight": if self._weight_quantize_type == 'channel_wise_abs_max': + quant_axis = 1 if op_node.name() in \ + _channelwise_quant_axis1_ops else 0 self._insert_post_channel_dequant_op(graph, op_node, quant_axis) else: -- GitLab