From 4bfadcd136d37b75ea43aeec8825e7d3a99e631d Mon Sep 17 00:00:00 2001 From: chengduoZH Date: Thu, 24 May 2018 12:31:18 +0800 Subject: [PATCH] fix data trans --- paddle/fluid/framework/data_device_transform.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/data_device_transform.cc b/paddle/fluid/framework/data_device_transform.cc index a876725ac..0cd2ebcd4 100644 --- a/paddle/fluid/framework/data_device_transform.cc +++ b/paddle/fluid/framework/data_device_transform.cc @@ -38,7 +38,8 @@ void TransDataDevice(const Tensor& in, const platform::Place& dst_place, auto* dev_ctx = GetDeviceContext(in.place(), dst_place); TensorCopy(in, dst_place, *dev_ctx, out); - if (platform::is_gpu_place(in.place()) && platform::is_cpu_place(dst_place)) { + + if (in.place().which() != dst_place.which()) { dev_ctx->Wait(); } } -- GitLab