"make plainNet shared"

cblas_new
dongzhihong 8 years ago
parent 73f4779808
commit 4876f35858

@ -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 {
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);

Loading…
Cancel
Save