diff --git a/paddle/fluid/framework/details/fetch_op_handle.cc b/paddle/fluid/framework/details/fetch_op_handle.cc index 88c7caadb798b3fb46e98d9d394fa5281d94e5e1..a3cae8c64cdff8594c8971b0458c443f54375f11 100644 --- a/paddle/fluid/framework/details/fetch_op_handle.cc +++ b/paddle/fluid/framework/details/fetch_op_handle.cc @@ -49,7 +49,9 @@ void FetchOpHandle::RunImpl() { platform::DeviceContextPool::Instance().Get(platform::CPUPlace()); for (auto *input : inputs_) { auto *var = static_cast(input); - if (var->generated_op_) var->generated_op_->Wait(cpu_ctx); + if (var->generated_op_) { + var->generated_op_->Wait(cpu_ctx); + } } tensors_.resize(inputs_.size()); auto *var_handle = static_cast(inputs_[0]); @@ -61,14 +63,9 @@ void FetchOpHandle::RunImpl() { auto &scope = scopes[i]; auto *var = scope->FindVar(kLocalExecScopeName)->Get()->FindVar(var_name); - if (var == nullptr) { - scope->FindVar(var_name); - } - PADDLE_ENFORCE_NOT_NULL(var, "Cannot find variable %s in execution scope", var_name); auto &t = var->Get(); - if (platform::is_gpu_place(t.place())) { #ifdef PADDLE_WITH_CUDA TensorCopySync(t, cpu, &tensors_[i]); diff --git a/paddle/fluid/framework/details/nccl_all_reduce_op_handle.cc b/paddle/fluid/framework/details/nccl_all_reduce_op_handle.cc index e568174957c8237344f5365c4cca46b9e43da0ca..16aa5d067ab7a222af8fbb6ca8ec18222ecd799b 100644 --- a/paddle/fluid/framework/details/nccl_all_reduce_op_handle.cc +++ b/paddle/fluid/framework/details/nccl_all_reduce_op_handle.cc @@ -36,7 +36,9 @@ void NCCLAllReduceOpHandle::RunImpl() { // Wait input done for (auto *in : inputs_) { auto &p = static_cast(in)->place_; - if (in->generated_op_) in->generated_op_->Wait(dev_ctxes_[p]); + if (in->generated_op_) { + in->generated_op_->Wait(dev_ctxes_[p]); + } } auto &var_name = static_cast(this->inputs_[0])->name_; diff --git a/paddle/fluid/framework/details/send_op_handle.cc b/paddle/fluid/framework/details/send_op_handle.cc index 797d795d3d729b89ca427387492073587109427f..bd97c5260dbba935e422793e0aa6aac8b6875627 100644 --- a/paddle/fluid/framework/details/send_op_handle.cc +++ b/paddle/fluid/framework/details/send_op_handle.cc @@ -32,7 +32,9 @@ void SendOpHandle::RunImpl() { if (in->DebugString() == "dummy") { // HACK continue; } - if (in->generated_op_) in->generated_op_->Wait(dev_ctxes_[p]); + if (in->generated_op_) { + in->generated_op_->Wait(dev_ctxes_[p]); + } } auto &tmp_scope = local_scope_->FindVar(kLocalExecScopeName)->Get(); // FIXME(wuyi): can not use RunAndRecordEvent here, for it will cause dead