From 332aadc0e86b93958002544021eeff42a3edec18 Mon Sep 17 00:00:00 2001 From: ceci3 Date: Mon, 19 Dec 2022 10:38:06 +0800 Subject: [PATCH] fix quant pass (#49123) --- .../contrib/slim/quantization/quantization_pass.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py index 81556d83f3..0a14b63266 100644 --- a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py +++ b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py @@ -1776,10 +1776,13 @@ class OutScaleForInferencePass: in_node = graph._find_node_by_name( op_node.outputs, var_name ) - if in_node.dtype() not in [ - core.VarDesc.VarType.FP64, - core.VarDesc.VarType.FP32, - ]: + if (in_node.node.var() is None) or ( + in_node.dtype() + not in [ + core.VarDesc.VarType.FP64, + core.VarDesc.VarType.FP32, + ] + ): continue scale_name = self._scale_name(var_name) -- GitLab