From 9a1d3b09b6fa8d5fe983e9e6c86a51912e05ac59 Mon Sep 17 00:00:00 2001 From: xulei2020 <“xulei83@huawei.com”> Date: Tue, 27 Oct 2020 16:46:33 +0800 Subject: [PATCH] fix dataset lite build with convert tool --- cmake/package_lite.cmake | 2 +- .../minddata/dataset/kernels/image/lite_cv/image_process.cc | 5 +++-- mindspore/lite/CMakeLists.txt | 6 ++++++ mindspore/lite/test/CMakeLists.txt | 6 ++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cmake/package_lite.cmake b/cmake/package_lite.cmake index 0605d6fb738..53b8f0e41a8 100644 --- a/cmake/package_lite.cmake +++ b/cmake/package_lite.cmake @@ -67,7 +67,7 @@ if (BUILD_MINDDATA STREQUAL "lite_cv") install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv DESTINATION ${MIND_DATA_INC_DIR} COMPONENT ${COMPONENT_NAME} FILES_MATCHING PATTERN "*.h") install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION ${MIND_DATA_LIB_DIR} COMPONENT ${COMPONENT_NAME}) else () - install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv DESTINATION ${MIND_DATA_INC_DIR_RUN_X86} COMPONENT ${COMPONENT_NAME} FILES_MATCHING PATTERN "*.h") + install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv DESTINATION ${MIND_DATA_INC_DIR_RUN_X86} COMPONENT ${RUN_X86_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h") install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION ${MIND_DATA_LIB_DIR_RUN_X86} COMPONENT ${RUN_X86_COMPONENT_NAME}) endif () endif () diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc index 9d59612e981..9db48711daf 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc @@ -620,11 +620,11 @@ static void PadWithConstant(const LiteMat &src, LiteMat &dst, const int top, con } bool ExtractChannel(const LiteMat &src, LiteMat &dst, int col) { - if (src.IsEmpty() || col < 0 || col > src.dims_ - 1) { + if (src.IsEmpty() || col < 0 || col > src.channel_ - 1) { return false; } - (void)dst.Init(src.width_, src.height_, 1, src.data_type_); if (src.data_type_ == LDataType::FLOAT32) { + (void)dst.Init(src.width_, src.height_, 1, src.data_type_); const float *src_start_p = src; float *dst_start_p = dst; for (int h = 0; h < src.height_; h++) { @@ -638,6 +638,7 @@ bool ExtractChannel(const LiteMat &src, LiteMat &dst, int col) { } return true; } else if (src.data_type_ == LDataType::UINT8) { + (void)dst.Init(src.width_, src.height_, 1, src.data_type_); const uint8_t *src_start_p = src; uint8_t *dst_start_p = dst; for (int h = 0; h < src.height_; h++) { diff --git a/mindspore/lite/CMakeLists.txt b/mindspore/lite/CMakeLists.txt index 5b3268dd2b5..67cc5c0ae3e 100644 --- a/mindspore/lite/CMakeLists.txt +++ b/mindspore/lite/CMakeLists.txt @@ -168,6 +168,12 @@ if (PLATFORM_ARM64) endif () endif () +if (PLATFORM_ARM32 OR PLATFORM_ARM64) + if (ENABLE_CONVERTER) + set(BUILD_MINDDATA "off") + endif() +endif() + if (BUILD_MINDDATA STREQUAL "lite" OR BUILD_MINDDATA STREQUAL "full") # add sentencepiece dependency # include(${TOP_DIR}/cmake/external_libs/sentencepiece.cmake) diff --git a/mindspore/lite/test/CMakeLists.txt b/mindspore/lite/test/CMakeLists.txt index 0073f229eb6..5f1772fe6ef 100644 --- a/mindspore/lite/test/CMakeLists.txt +++ b/mindspore/lite/test/CMakeLists.txt @@ -88,6 +88,12 @@ if (SUPPORT_GPU) ${LITE_DIR}/src/runtime/kernel/opencl/utils.cc ) endif() + +if (PLATFORM_ARM32 OR PLATFORM_ARM64) + if (ENABLE_CONVERTER) + set(BUILD_MINDDATA "off") + endif() +endif() ### minddata lite if (BUILD_MINDDATA STREQUAL "lite") # include_directories(${CCSRC_DIR}/minddata)