From 397781f1a140e93cd5f84ab6f3a876213bc426a7 Mon Sep 17 00:00:00 2001 From: ceci3 Date: Tue, 25 Jan 2022 18:16:08 +0800 Subject: [PATCH] fix save channel wise quant model (#39054) (#39100) --- .../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 645feda21f0..efa000274d0 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