From 651aad061c3b3b82951c0304e379fb7279aa284b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=98=8E=E5=86=AC?= <78149749+winter-wang@users.noreply.github.com> Date: Tue, 13 Jul 2021 14:19:56 +0800 Subject: [PATCH] [pass_enhance] skip the atrribute check used for quantization, test=develop (#34095) --- paddle/fluid/framework/ir/op_compat_sensible_pass.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/paddle/fluid/framework/ir/op_compat_sensible_pass.cc b/paddle/fluid/framework/ir/op_compat_sensible_pass.cc index 1574bb739dd..8f814822b6a 100644 --- a/paddle/fluid/framework/ir/op_compat_sensible_pass.cc +++ b/paddle/fluid/framework/ir/op_compat_sensible_pass.cc @@ -179,6 +179,12 @@ bool OpCompat::Judge(const OpDesc& op_desc) { } for (auto& attr_map : op_desc.GetAttrMap()) { + const std::string& name = attr_map.first; + if (name.size() >= 10u && + 0 == name.compare(name.size() - 10u, 10u, "_threshold")) { + continue; // skip the attribute ends with "_threshold", it used for + // quantization. + } if (attr_compats_.find(attr_map.first) == attr_compats_.end()) { if (global_extra_attrs.find(attr_map.first) != global_extra_attrs.end() || extra_attrs_.find(attr_map.first) != extra_attrs_.end()) { -- GitLab