提交 b64dde2a 编写于 作者: Y Yang Yang

fix share tensor

上级 6f7b346f
...@@ -247,14 +247,13 @@ class ParallelDoGradOp : public framework::OperatorBase { ...@@ -247,14 +247,13 @@ class ParallelDoGradOp : public framework::OperatorBase {
auto *tmp = sub_scopes[0]->Var(&tmp_name); auto *tmp = sub_scopes[0]->Var(&tmp_name);
for (size_t i = 1; i < sub_scopes.size(); ++i) { for (size_t i = 1; i < sub_scopes.size(); ++i) {
if (!(places[i] == places[0])) { CopyOrShare(*sub_scopes[i]->FindVar(s), places[0], tmp);
CopyOrShare(*sub_scopes[i]->FindVar(s), places[0], tmp); WaitOnPlace(places[0]);
WaitOnPlace(places[0]);
}
auto sum_op = framework::OpRegistry::CreateOp( auto sum_op = framework::OpRegistry::CreateOp(
"sum", {{"X", {s, tmp_name}}}, {{"Out", {s}}}, "sum", {{"X", {s, tmp_name}}}, {{"Out", {s}}},
framework::AttributeMap{}); framework::AttributeMap{});
VLOG(3) << sum_op->DebugStringEx(sub_scopes[0]);
sum_op->Run(*sub_scopes[0], places[0]); sum_op->Run(*sub_scopes[0], places[0]);
WaitOnPlace(places[0]); WaitOnPlace(places[0]);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册