From 60bbc691bbc7603cdd3fb754f0f7560025a1b952 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Tue, 3 Sep 2019 11:25:59 +0800 Subject: [PATCH] refine the attr assert (#1947) test=develop --- lite/core/mir/pattern_matcher.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lite/core/mir/pattern_matcher.h b/lite/core/mir/pattern_matcher.h index 42d1b3fe55..47a0a30b56 100644 --- a/lite/core/mir/pattern_matcher.h +++ b/lite/core/mir/pattern_matcher.h @@ -157,16 +157,8 @@ struct PMNode { template PMNode* assert_op_attr(const std::string& attr_name, const T& attr) { - asserts_.push_back([=](const Node* x) { - if (x && x->IsStmt()) { - auto* op_info = x->stmt()->op_info(); - bool cond = (op_info->HasAttr(attr_name) && - op_info->GetAttr(attr_name) == attr); - return cond; - } - return false; - }); - return this; + return assert_op_attr_satisfied( + attr_name, [=](const T& src) { return src == attr; }); } private: -- GitLab