提交 f3210b60 编写于 作者: Q Qiao Longfei

fix copy_memory and share_memory

上级 69484f71
...@@ -419,13 +419,13 @@ void ParallelExecutor::BCastParamsToDevices( ...@@ -419,13 +419,13 @@ void ParallelExecutor::BCastParamsToDevices(
auto local_scope = member_->local_scopes_[i]; auto local_scope = member_->local_scopes_[i];
auto *t = local_scope->Var(var)->GetMutable<LoDTensor>(); auto *t = local_scope->Var(var)->GetMutable<LoDTensor>();
auto share_memory = [&] { auto copy_memory = [&] {
t->Resize(dims); t->Resize(dims);
t->mutable_data(cpu, main_tensor.type()); t->mutable_data(cpu, main_tensor.type());
paddle::framework::TensorCopy(main_tensor, cpu, t); paddle::framework::TensorCopy(main_tensor, cpu, t);
}; };
auto copy_memory = [&] { t->ShareDataWith(main_tensor); }; auto share_memory = [&] { t->ShareDataWith(main_tensor); };
// FIXME(zcd): LR_DECAY_COUNTER should not be shared. This is a hot fix. // FIXME(zcd): LR_DECAY_COUNTER should not be shared. This is a hot fix.
if (member_->build_strategy_.async_mode_) { if (member_->build_strategy_.async_mode_) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册