diff --git a/paddle/operators/fetch_op.cc b/paddle/operators/fetch_op.cc index c35d7d49e31f6ca11e2b37a455af430aac50a232..f1086e3dc774a5e57f1abb5d4f91f859fc0e64aa 100644 --- a/paddle/operators/fetch_op.cc +++ b/paddle/operators/fetch_op.cc @@ -52,6 +52,7 @@ class FetchOp : public framework::OperatorBase { // FIXME(yuyang18): Should we assume the fetch operator always generate // CPU outputs? dst_item.CopyFrom(src_item, platform::CPUPlace(), dev_ctx); + dev_ctx.Wait(); dst_item.set_lod(src_item.lod()); VLOG(3) << "Fetch variable " << fetch_var_name << " to " << out_name;