未验证 提交 60bbc691 编写于 作者: T tensor-tang 提交者: GitHub

refine the attr assert (#1947)

test=develop
上级 6f0491bf
...@@ -157,16 +157,8 @@ struct PMNode { ...@@ -157,16 +157,8 @@ struct PMNode {
template <typename T> template <typename T>
PMNode* assert_op_attr(const std::string& attr_name, const T& attr) { PMNode* assert_op_attr(const std::string& attr_name, const T& attr) {
asserts_.push_back([=](const Node* x) { return assert_op_attr_satisfied<T>(
if (x && x->IsStmt()) { attr_name, [=](const T& src) { return src == attr; });
auto* op_info = x->stmt()->op_info();
bool cond = (op_info->HasAttr(attr_name) &&
op_info->GetAttr<T>(attr_name) == attr);
return cond;
}
return false;
});
return this;
} }
private: private:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册