提交 6cf396b6 编写于 作者: Y Yu Yang

Merge branch 'feature/pybind_for_protobuf_desc' of github.com:reyoung/Paddle...

Merge branch 'feature/pybind_for_protobuf_desc' of github.com:reyoung/Paddle into feature/pybind_for_protobuf_desc
...@@ -214,6 +214,12 @@ public: ...@@ -214,6 +214,12 @@ public:
return ops_.back().get(); return ops_.back().get();
} }
OpDescBind *PrependOp() {
need_update_ = true;
ops_.emplace_front(new OpDescBind());
return ops_.front().get();
}
void Sync() { void Sync() {
if (need_update_) { if (need_update_) {
auto &op_field = *this->desc_->mutable_ops(); auto &op_field = *this->desc_->mutable_ops();
...@@ -329,6 +335,9 @@ void BindBlockDesc(py::module &m) { ...@@ -329,6 +335,9 @@ void BindBlockDesc(py::module &m) {
.def("append_op", .def("append_op",
&BlockDescBind::AppendOp, &BlockDescBind::AppendOp,
py::return_value_policy::reference) py::return_value_policy::reference)
.def("prepend_op",
&BlockDescBind::PrependOp,
py::return_value_policy::reference)
.def("new_var", .def("new_var",
&BlockDescBind::NewVar, &BlockDescBind::NewVar,
py::return_value_policy::reference); py::return_value_policy::reference);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册