提交 5db273d8 编写于 作者: L luotao1

enhance HasAttr to fix ci

test=develop
上级 4a4daa8a
...@@ -238,13 +238,23 @@ void OpDesc::SetOutput(const std::string &param_name, ...@@ -238,13 +238,23 @@ void OpDesc::SetOutput(const std::string &param_name,
} }
bool OpDesc::HasAttr(const std::string &name) const { bool OpDesc::HasAttr(const std::string &name) const {
const proto::OpProto &proto = OpInfoMap::Instance().Get(desc_.type()).Proto(); if (attrs_.find(name) != attrs_.end()) {
return true;
} else {
auto &op_info = OpInfoMap::Instance();
if (op_info.Has(desc_.type())) {
auto op_info_ptr = op_info.Get(desc_.type());
if (op_info_ptr.HasOpProtoAndChecker()) {
const proto::OpProto &proto = op_info_ptr.Proto();
for (int i = 0; i != proto.attrs_size(); ++i) { for (int i = 0; i != proto.attrs_size(); ++i) {
const proto::OpProto::Attr &attr = proto.attrs(i); const proto::OpProto::Attr &attr = proto.attrs(i);
if (attr.name() == name) { if (attr.name() == name) {
return true; return true;
} }
} }
}
}
}
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册