diff --git a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py index f0caabd6f4ea19a0ca22e64bd80323281b54aaa5..8902b40aa68e521869508e4bbd9b0d1c2b3022fd 100644 --- a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py +++ b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py @@ -2481,11 +2481,6 @@ class QuantizationTransformPassV2(QuantizationTransformPass): self.create_var_map = {} self.create_op_map = {} - # marked the variable which has been dequantized. - self.dequantized_vars = collections.OrderedDict() - self.persistable_vars = [] - self.processed_vars = [] - def _quant_preprocess(self, op_node): user_skipped = False if isinstance(self._skip_pattern, list): @@ -2627,6 +2622,10 @@ class QuantizationTransformPassV2(QuantizationTransformPass): ), 'graph must be the instance of IrGraph.' if self._is_test is None: self._is_test = graph.is_test() + # marked the variable which has been dequantized. + self.dequantized_vars = collections.OrderedDict() + self.persistable_vars = [] + self.processed_vars = [] self.persistable_vars = [ p.name() for p in graph.all_persistable_nodes()