Skip to content

Commit 93c4700

Browse files
chengduoYang Yang(Tony)
authored andcommitted
fix DataTransFunc (#10752)
1 parent d0a62bf commit 93c4700

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

paddle/fluid/framework/data_device_transform.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ void TransDataDevice(const Tensor& in, const platform::Place& dst_place,
3636
VLOG(3) << "DeviceTransform in, src_place " << in.place()
3737
<< " dst_place: " << dst_place;
3838
auto* dev_ctx = GetDeviceContext(in.place(), dst_place);
39-
dev_ctx->Wait();
39+
4040
TensorCopy(in, dst_place, *dev_ctx, out);
41-
dev_ctx->Wait();
41+
if (platform::is_gpu_place(in.place()) && platform::is_cpu_place(dst_place)) {
42+
dev_ctx->Wait();
43+
}
4244
}
4345

4446
} // namespace framework

0 commit comments

Comments
 (0)