From c838c1ed99ab68ff1b4b4261bf659780572fc242 Mon Sep 17 00:00:00 2001 From: ceci3 Date: Tue, 6 Dec 2022 19:45:32 +0800 Subject: [PATCH] clear tmp var in ptq (#48660) --- .../contrib/slim/quantization/post_training_quantization.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/paddle/fluid/contrib/slim/quantization/post_training_quantization.py b/python/paddle/fluid/contrib/slim/quantization/post_training_quantization.py index 68df2a8adc..fa57a9bd74 100644 --- a/python/paddle/fluid/contrib/slim/quantization/post_training_quantization.py +++ b/python/paddle/fluid/contrib/slim/quantization/post_training_quantization.py @@ -692,11 +692,10 @@ class PostTrainingQuantization: ''' Reset activations to be not persistable. ''' - to_erase = [] for var in self._program.list_vars(): if var.name in self._quantized_act_var_name: var.persistable = False - to_erase.append(var.name) + self._scope.find_var(var.name).get_tensor()._clear() def _sampling(self): ''' -- GitLab