diff --git a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py index 81556d83f3a34128c95fdd1d2021cbab3b27a06f..0a14b6326674ba65a6175e20d66e9f8de557bf3d 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)