From da55cf6d50649ca84d32f990eade8d03d16fd552 Mon Sep 17 00:00:00 2001 From: lizhenyu Date: Fri, 22 May 2020 16:07:05 +0800 Subject: [PATCH] fix summary bug of gradient --- mindspore/ccsrc/session/session_basic.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mindspore/ccsrc/session/session_basic.cc b/mindspore/ccsrc/session/session_basic.cc index 11e44154c..b7c73469c 100644 --- a/mindspore/ccsrc/session/session_basic.cc +++ b/mindspore/ccsrc/session/session_basic.cc @@ -785,6 +785,9 @@ void SessionBasic::Summary(KernelGraph *graph) { (void)std::copy(shape.begin(), shape.end(), std::back_inserter(temp_shape)); tensor::TensorPtr tensor = std::make_shared(type_id, temp_shape); MS_EXCEPTION_IF_NULL(address); + if (!address->GetPtr()) { + continue; + } if (!address->SyncDeviceToHost(trans::GetRuntimePaddingShape(node, index), LongToSize(tensor->data().nbytes()), tensor->data_type(), tensor->data_c(true))) { MS_LOG(ERROR) << "Failed to sync output from device to host."; -- GitLab