|
|
|
@ -237,20 +237,16 @@ void OpDesc::SetOutput(const std::string ¶m_name,
|
|
|
|
|
this->outputs_[param_name] = args;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool OpDesc::HasAttr(const std::string &name) const {
|
|
|
|
|
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) {
|
|
|
|
|
const proto::OpProto::Attr &attr = proto.attrs(i);
|
|
|
|
|
if (attr.name() == name) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
bool OpDesc::HasProtoAttr(const std::string &name) const {
|
|
|
|
|
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) {
|
|
|
|
|
const proto::OpProto::Attr &attr = proto.attrs(i);
|
|
|
|
|
if (attr.name() == name) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|