提交 dcb09e93 编写于 作者: Y Yu Yang

Use PROTO_LITE when refactoring Paddle

It will significantly reduce binary size. It is useful for mobile
deployment.
上级 d23cd514
...@@ -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();
} }
......
...@@ -31,8 +31,6 @@ class ProgramDescBind { ...@@ -31,8 +31,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.
先完成此消息的编辑!
想要评论请 注册