Skip to content

Commit 676dfd1

Browse files
committed
follow comments
1 parent aff8a26 commit 676dfd1

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

paddle/fluid/framework/details/fetch_op_handle.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ void FetchOpHandle::RunImpl() {
4949
platform::DeviceContextPool::Instance().Get(platform::CPUPlace());
5050
for (auto *input : inputs_) {
5151
auto *var = static_cast<VarHandle *>(input);
52-
if (var->generated_op_) var->generated_op_->Wait(cpu_ctx);
52+
if (var->generated_op_) {
53+
var->generated_op_->Wait(cpu_ctx);
54+
}
5355
}
5456
tensors_.resize(inputs_.size());
5557
auto *var_handle = static_cast<VarHandle *>(inputs_[0]);
@@ -61,14 +63,9 @@ void FetchOpHandle::RunImpl() {
6163
auto &scope = scopes[i];
6264
auto *var =
6365
scope->FindVar(kLocalExecScopeName)->Get<Scope *>()->FindVar(var_name);
64-
if (var == nullptr) {
65-
scope->FindVar(var_name);
66-
}
67-
6866
PADDLE_ENFORCE_NOT_NULL(var, "Cannot find variable %s in execution scope",
6967
var_name);
7068
auto &t = var->Get<framework::LoDTensor>();
71-
7269
if (platform::is_gpu_place(t.place())) {
7370
#ifdef PADDLE_WITH_CUDA
7471
TensorCopySync(t, cpu, &tensors_[i]);

paddle/fluid/framework/details/nccl_all_reduce_op_handle.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ void NCCLAllReduceOpHandle::RunImpl() {
3636
// Wait input done
3737
for (auto *in : inputs_) {
3838
auto &p = static_cast<VarHandle *>(in)->place_;
39-
if (in->generated_op_) in->generated_op_->Wait(dev_ctxes_[p]);
39+
if (in->generated_op_) {
40+
in->generated_op_->Wait(dev_ctxes_[p]);
41+
}
4042
}
4143

4244
auto &var_name = static_cast<VarHandle *>(this->inputs_[0])->name_;

paddle/fluid/framework/details/send_op_handle.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ void SendOpHandle::RunImpl() {
3232
if (in->DebugString() == "dummy") { // HACK
3333
continue;
3434
}
35-
if (in->generated_op_) in->generated_op_->Wait(dev_ctxes_[p]);
35+
if (in->generated_op_) {
36+
in->generated_op_->Wait(dev_ctxes_[p]);
37+
}
3638
}
3739
auto &tmp_scope = local_scope_->FindVar(kLocalExecScopeName)->Get<Scope *>();
3840
// FIXME(wuyi): can not use RunAndRecordEvent here, for it will cause dead

0 commit comments

Comments
 (0)