From 5d6f7204d321435ff2f1c5f2a70bbd106a903577 Mon Sep 17 00:00:00 2001 From: lizhenyu Date: Mon, 24 Aug 2020 20:13:23 +0800 Subject: [PATCH] [bugfix]LSTM SyncDeviceToHost failed --- mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc b/mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc index 521e280f900..46e8b96a1cf 100644 --- a/mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc +++ b/mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc @@ -32,7 +32,7 @@ namespace device { namespace gpu { bool GPUDeviceAddress::SyncDeviceToHost(const std::vector &, size_t size, TypeId, void *host_ptr) const { MS_EXCEPTION_IF_NULL(host_ptr); - bool need_sync = (size != 0) && (size_ != 0); + bool need_sync = (size != 0) && (size_ != 0) && (size <= size_); if (!need_sync) { return true; } @@ -52,7 +52,7 @@ bool GPUDeviceAddress::SyncDeviceToHost(const std::vector &, size_t size, T bool GPUDeviceAddress::SyncHostToDevice(const std::vector &, size_t size, TypeId, const void *host_ptr) const { MS_EXCEPTION_IF_NULL(host_ptr); - bool need_sync = (size != 0) && (size_ != 0); + bool need_sync = (size != 0) && (size_ != 0) && (size <= size_); if (!need_sync) { return true; }