From a948fe05ab8c6c50fd1a9535500a199545ad2bec Mon Sep 17 00:00:00 2001 From: xuyongfei Date: Wed, 19 Aug 2020 11:32:47 +0800 Subject: [PATCH] serving: update build.sh to add minddata support for acl --- build.sh | 4 ---- mindspore/ccsrc/backend/session/infer_session.cc | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 79e112b0ef..990235bbef 100755 --- a/build.sh +++ b/build.sh @@ -392,11 +392,7 @@ build_mindspore() if [[ -n "$VERBOSE" ]]; then CMAKE_VERBOSE="--verbose" fi - if [[ "X$ENABLE_ACL" = "Xon" ]]; then - cmake --build . ${CMAKE_VERBOSE} -j$THREAD_NUM - else cmake --build . --target package ${CMAKE_VERBOSE} -j$THREAD_NUM - fi echo "success to build mindspore project!" } diff --git a/mindspore/ccsrc/backend/session/infer_session.cc b/mindspore/ccsrc/backend/session/infer_session.cc index b7829795b2..3d6d5c0d7b 100644 --- a/mindspore/ccsrc/backend/session/infer_session.cc +++ b/mindspore/ccsrc/backend/session/infer_session.cc @@ -141,7 +141,7 @@ Status ServingTensor2MSTensor(size_t index, const InferTensorBase &out_tensor, t } ms_tensor = std::make_shared(data_type, shape); - if (ms_tensor->Size() != out_tensor.data_size()) { + if (out_tensor.data_size() == 0 || ms_tensor->Size() != out_tensor.data_size()) { MSI_LOG_ERROR << "input " << std::to_string(index) << " data size not match shape and dtype, calculated required size " << ms_tensor->Size() << ", given " << out_tensor.data_size(); @@ -149,6 +149,10 @@ Status ServingTensor2MSTensor(size_t index, const InferTensorBase &out_tensor, t << " data size not match shape and dtype, calculated required size " << ms_tensor->Size() << ", given " << out_tensor.data_size(); } + if (out_tensor.data() == nullptr || ms_tensor->data_c() == nullptr) { + MSI_LOG_ERROR << "invalid data buffer"; + return FAILED; + } memcpy_s(ms_tensor->data_c(), ms_tensor->Size(), out_tensor.data(), out_tensor.data_size()); return SUCCESS; }