提交 4876f358 编写于 作者: D dongzhihong

"make plainNet shared"

上级 73f47798
...@@ -29,4 +29,4 @@ add_dependencies(framework_py_proto framework_py_proto_init) ...@@ -29,4 +29,4 @@ add_dependencies(framework_py_proto framework_py_proto_init)
proto_library(net_proto SRCS net_proto.proto DEPS op_proto) proto_library(net_proto SRCS net_proto.proto DEPS op_proto)
# cc_library(net SRCS net.cc DEPS operator net_proto op_registry fc_op) # cc_library(net SRCS net.cc DEPS operator net_proto op_registry fc_op)
cc_library(net SRCS net.cc DEPS operator net_proto op_registry) cc_library(net SRCS net.cc DEPS operator net_proto op_registry)
cc_test(net_op_test SRCS net_op_test.cc DEPS net) cc_test(net_op_test SRCS net_op_test.cc DEPS net my_fc_op)
...@@ -21,10 +21,9 @@ namespace paddle { ...@@ -21,10 +21,9 @@ namespace paddle {
namespace framework { namespace framework {
std::shared_ptr<PlainNet> AddBackwardOp(std::shared_ptr<PlainNet> ForwardOps) { std::shared_ptr<PlainNet> AddBackwardOp(std::shared_ptr<PlainNet> ForwardOps) {
// NetPtr->reset(new PlainNet); auto grad_ops = std::make_shared<PlainNet>();
// NetPtr grad_ops = new PlainNet; // std::shared_ptr<PlainNet> grad_ops;
std::shared_ptr<PlainNet> grad_ops; // grad_ops.reset(new PlainNet);
grad_ops.reset(new PlainNet);
for (auto& op : ForwardOps->ops_) { for (auto& op : ForwardOps->ops_) {
auto op_grad = OpRegistry::CreateGradOp(op); auto op_grad = OpRegistry::CreateGradOp(op);
grad_ops->AddOp(op_grad); grad_ops->AddOp(op_grad);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册