diff --git a/paddle/fluid/operators/controlflow/conditional_block_op.h b/paddle/fluid/operators/controlflow/conditional_block_op.h index 2f8717c6c67e2db5edbae4f43e8fbdd220432b1b..67e6394d94ebfcf431f41168aa33c1794084dce7 100644 --- a/paddle/fluid/operators/controlflow/conditional_block_op.h +++ b/paddle/fluid/operators/controlflow/conditional_block_op.h @@ -79,8 +79,7 @@ class ConditionalOp : public framework::OperatorBase { platform::DeviceContextPool::Instance().Get(ips[0]->place())->Wait(); res = cpu_tensor.data()[0]; #endif - } - if (platform::is_npu_place(ips[0]->place())) { + } else if (platform::is_npu_place(ips[0]->place())) { #ifdef PADDLE_WITH_ASCEND_CL framework::LoDTensor cpu_tensor; framework::TensorCopy(*ips[0], platform::CPUPlace(), &cpu_tensor);