serving: update build.sh to add minddata support for acl

This commit is contained in:
xuyongfei 2020-08-19 11:32:47 +08:00
parent 3259dafa7e
commit a948fe05ab
2 changed files with 5 additions and 5 deletions

View File

@ -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!"
}

View File

@ -141,7 +141,7 @@ Status ServingTensor2MSTensor(size_t index, const InferTensorBase &out_tensor, t
}
ms_tensor = std::make_shared<tensor::Tensor>(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;
}