提交 b33779d6 编写于 作者: Y Yu Yang 提交者: GitHub

Merge pull request #4648 from reyoung/feature/use_proto_lite_for_refacting

Use PROTO_LITE when refactoring Paddle
...@@ -15,6 +15,7 @@ limitations under the License. */ ...@@ -15,6 +15,7 @@ limitations under the License. */
#pragma once #pragma once
#include <deque> #include <deque>
#include <memory>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "paddle/framework/op_desc.h" #include "paddle/framework/op_desc.h"
......
...@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and ...@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
syntax = "proto2"; syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package paddle.framework; package paddle.framework;
enum AttrType { enum AttrType {
......
...@@ -52,8 +52,6 @@ class OpDescBind { ...@@ -52,8 +52,6 @@ class OpDescBind {
void SetOutput(const std::string &param_name, void SetOutput(const std::string &param_name,
const std::vector<std::string> &args); const std::vector<std::string> &args);
std::string DebugString() { return this->Proto()->DebugString(); }
bool HasAttr(const std::string &name) const { bool HasAttr(const std::string &name) const {
return attrs_.find(name) != attrs_.end(); return attrs_.find(name) != attrs_.end();
} }
......
...@@ -14,6 +14,7 @@ limitations under the License. */ ...@@ -14,6 +14,7 @@ limitations under the License. */
#pragma once #pragma once
#include <memory>
#include <vector> #include <vector>
#include "paddle/framework/framework.pb.h" #include "paddle/framework/framework.pb.h"
#include "paddle/platform/macros.h" #include "paddle/platform/macros.h"
...@@ -31,8 +32,6 @@ class ProgramDescBind { ...@@ -31,8 +32,6 @@ class ProgramDescBind {
BlockDescBind *Block(size_t idx) { return blocks_[idx].get(); } BlockDescBind *Block(size_t idx) { return blocks_[idx].get(); }
std::string DebugString() { return Proto()->DebugString(); }
size_t Size() const { return blocks_.size(); } size_t Size() const { return blocks_.size(); }
ProgramDesc *Proto(); ProgramDesc *Proto();
......
...@@ -14,6 +14,7 @@ limitations under the License. */ ...@@ -14,6 +14,7 @@ limitations under the License. */
#pragma once #pragma once
#include <set>
#include "paddle/framework/framework.pb.h" #include "paddle/framework/framework.pb.h"
#include "paddle/framework/op_registry.h" #include "paddle/framework/op_registry.h"
......
...@@ -117,7 +117,6 @@ void BindProgramDesc(py::module &m) { ...@@ -117,7 +117,6 @@ void BindProgramDesc(py::module &m) {
.def("append_block", &ProgramDescBind::AppendBlock, .def("append_block", &ProgramDescBind::AppendBlock,
py::return_value_policy::reference) py::return_value_policy::reference)
.def("block", &ProgramDescBind::Block, py::return_value_policy::reference) .def("block", &ProgramDescBind::Block, py::return_value_policy::reference)
.def("__str__", &ProgramDescBind::DebugString)
.def("num_blocks", &ProgramDescBind::Size); .def("num_blocks", &ProgramDescBind::Size);
} }
...@@ -191,8 +190,6 @@ void BindOpDesc(py::module &m) { ...@@ -191,8 +190,6 @@ void BindOpDesc(py::module &m) {
.def("output", &OpDescBind::Output) .def("output", &OpDescBind::Output)
.def("output_names", &OpDescBind::OutputNames) .def("output_names", &OpDescBind::OutputNames)
.def("set_output", &OpDescBind::SetOutput) .def("set_output", &OpDescBind::SetOutput)
.def("__str__", &OpDescBind::DebugString)
.def("__repr__", &OpDescBind::DebugString)
.def("has_attr", &OpDescBind::HasAttr) .def("has_attr", &OpDescBind::HasAttr)
.def("attr_type", &OpDescBind::GetAttrType) .def("attr_type", &OpDescBind::GetAttrType)
.def("attr_names", &OpDescBind::AttrNames) .def("attr_names", &OpDescBind::AttrNames)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册