diff --git a/paddle/fluid/framework/op_desc.cc b/paddle/fluid/framework/op_desc.cc index 9399b8675e1422d5a0e6784d6ad98c5d7568ed0c..af26cf287205833ebdfe1c3971b760adbf5c0a68 100644 --- a/paddle/fluid/framework/op_desc.cc +++ b/paddle/fluid/framework/op_desc.cc @@ -275,8 +275,9 @@ Attribute OpDesc::GetAttr(const std::string &name) const { return it->second; } -const proto::OpProto::Attr &OpDesc::GetProtoAttr(const std::string &name) { - proto::OpProto &proto = OpInfoMap::Instance().Get(Type()).Proto(); +const proto::OpProto::Attr &OpDesc::GetProtoAttr( + const std::string &name) const { + const proto::OpProto &proto = OpInfoMap::Instance().Get(Type()).Proto(); for (int i = 0; i != proto.attrs_size(); ++i) { const proto::OpProto::Attr &attr = proto.attrs(i); if (attr.name() == name) {