From fa0129435f29f15202c00d2bea4053b2fd7b3862 Mon Sep 17 00:00:00 2001 From: xutianchun Date: Wed, 23 Dec 2020 09:54:45 +0800 Subject: [PATCH] rename net_train to benchmark_train --- cmake/external_libs/flatbuffers.cmake | 2 +- mindspore/lite/CMakeLists.txt | 2 +- .../examples/train_lenet/src/net_runner.cc | 3 +- .../lite/examples/train_lenet/src/utils.h | 4 + .../transfer_learning/src/net_runner.cc | 3 +- .../examples/transfer_learning/src/utils.h | 5 ++ mindspore/lite/test/run_net_train.sh | 82 +++++++++---------- .../CMakeLists.txt | 24 +++--- .../{net_train => benchmark_train}/main.cc | 2 +- .../net_train.cc | 2 +- .../net_train.h | 0 mindspore/lite/tools/converter/converter.cc | 3 + scripts/lite_release_package.sh | 8 +- 13 files changed, 77 insertions(+), 63 deletions(-) rename mindspore/lite/tools/{net_train => benchmark_train}/CMakeLists.txt (53%) rename mindspore/lite/tools/{net_train => benchmark_train}/main.cc (95%) rename mindspore/lite/tools/{net_train => benchmark_train}/net_train.cc (99%) rename mindspore/lite/tools/{net_train => benchmark_train}/net_train.h (100%) diff --git a/cmake/external_libs/flatbuffers.cmake b/cmake/external_libs/flatbuffers.cmake index e7071aad190..c7403f3dc2b 100644 --- a/cmake/external_libs/flatbuffers.cmake +++ b/cmake/external_libs/flatbuffers.cmake @@ -18,7 +18,7 @@ mindspore_add_pkg(flatbuffers EXE flatc URL ${REQ_URL} MD5 ${MD5} - CMAKE_OPTION -DFLATBUFFERS_BUILD_TESTS=OFF ) + CMAKE_OPTION -DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib) include_directories(${flatbuffers_INC}) add_library(mindspore::flatbuffers ALIAS flatbuffers::flatbuffers) diff --git a/mindspore/lite/CMakeLists.txt b/mindspore/lite/CMakeLists.txt index ed949173f40..a03e47c4f41 100644 --- a/mindspore/lite/CMakeLists.txt +++ b/mindspore/lite/CMakeLists.txt @@ -230,7 +230,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/nnacl) if (ENABLE_TOOLS) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark) if (SUPPORT_TRAIN) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/net_train) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark_train) endif () endif () if (NOT WIN32) diff --git a/mindspore/lite/examples/train_lenet/src/net_runner.cc b/mindspore/lite/examples/train_lenet/src/net_runner.cc index 09beb5dfb19..8c343bcb6a1 100644 --- a/mindspore/lite/examples/train_lenet/src/net_runner.cc +++ b/mindspore/lite/examples/train_lenet/src/net_runner.cc @@ -17,6 +17,7 @@ #include "src/net_runner.h" #include #include +#include #include #include #include "include/context.h" @@ -104,7 +105,7 @@ std::vector NetRunner::FillInputData(const std::vector &dat int label = 0; char *data = nullptr; std::tie(data, label) = dataset[idx]; - memcpy(input_data + i * data_size_, data, data_size_); + std::memcpy(input_data + i * data_size_, data, data_size_); labels[i * num_of_classes_ + label] = 1.0; // Model expects labels in onehot representation labels_vec.push_back(label); } diff --git a/mindspore/lite/examples/train_lenet/src/utils.h b/mindspore/lite/examples/train_lenet/src/utils.h index de3c7e7279e..54927df2af1 100644 --- a/mindspore/lite/examples/train_lenet/src/utils.h +++ b/mindspore/lite/examples/train_lenet/src/utils.h @@ -17,6 +17,10 @@ #ifndef MINDSPORE_LITE_EXAMPLES_TRAIN_LENET_SRC_UTILS_H_ #define MINDSPORE_LITE_EXAMPLES_TRAIN_LENET_SRC_UTILS_H_ +// DEBUG should be defined because the source code use assert to test exception +// but the Code Analysis Tool not allow us to use assert directly +#define DEBUG TRUE + #ifdef DEBUG #include #define MS_ASSERT(f) assert(f) diff --git a/mindspore/lite/examples/transfer_learning/src/net_runner.cc b/mindspore/lite/examples/transfer_learning/src/net_runner.cc index eceb86308a9..d8128dcccb4 100644 --- a/mindspore/lite/examples/transfer_learning/src/net_runner.cc +++ b/mindspore/lite/examples/transfer_learning/src/net_runner.cc @@ -17,6 +17,7 @@ #include "src/net_runner.h" #include #include +#include #include #include #include "include/context.h" @@ -112,7 +113,7 @@ std::vector NetRunner::FillInputData(const std::vector &dat int label = 0; char *data = nullptr; std::tie(data, label) = dataset[idx]; - memcpy(input_data + i * data_size_, data, data_size_); + std::memcpy(input_data + i * data_size_, data, data_size_); labels[i * num_of_classes_ + label] = 1.0; // Model expects labels in onehot representation labels_vec.push_back(label); } diff --git a/mindspore/lite/examples/transfer_learning/src/utils.h b/mindspore/lite/examples/transfer_learning/src/utils.h index 5e0535acd78..bbd855b801d 100644 --- a/mindspore/lite/examples/transfer_learning/src/utils.h +++ b/mindspore/lite/examples/transfer_learning/src/utils.h @@ -17,6 +17,11 @@ #ifndef MINDSPORE_LITE_EXAMPLES_TRANSFER_LEARNING_SRC_UTILS_H_ #define MINDSPORE_LITE_EXAMPLES_TRANSFER_LEARNING_SRC_UTILS_H_ +// DEBUG should be defined because the source code use assert to test exception +// but the Code Analysis Tool not allow us to use assert directly + +#define DEBUG TRUE + #ifdef DEBUG #include #define MS_ASSERT(f) assert(f) diff --git a/mindspore/lite/test/run_net_train.sh b/mindspore/lite/test/run_net_train.sh index 6e688495220..a5435384feb 100755 --- a/mindspore/lite/test/run_net_train.sh +++ b/mindspore/lite/test/run_net_train.sh @@ -75,19 +75,19 @@ function Run_x86() { echo ${model_name}'_train' >> "${run_x86_log_file}" echo 'cd '${x86_path}'/mindspore-lite-'${version}'-train-linux-x64' >> "${run_x86_log_file}" cd ${x86_path}/mindspore-lite-${version}-train-linux-x64 || return 1 - echo 'LD_LIBRARY_PATH='${LD_LIBRARY_PATH}':./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./net_train/net_train --epochs='${epoch_num}' --modelFile='${ms_models_path}'/'${model_name}'_train.ms --inDataFile='${train_io_path}/${model_name}_input1.bin,${train_io_path}/${model_name}_input2.bin' --expectedDataFile='${train_io_path}'/'${model_name}'_outputs.bin --exportFile='${ms_models_path}'/'${model_name}'_train_exported.ms' >> "${run_x86_log_file}" + echo 'LD_LIBRARY_PATH='${LD_LIBRARY_PATH}':./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib;./benchmark_train/benchmark_train --epochs='${epoch_num}' --modelFile='${ms_models_path}'/'${model_name}'_train.ms --inDataFile='${train_io_path}/${model_name}_input1.bin,${train_io_path}/${model_name}_input2.bin' --expectedDataFile='${train_io_path}'/'${model_name}'_outputs.bin --exportFile='${ms_models_path}'/'${model_name}'_train_exported.ms' >> "${run_x86_log_file}" echo '-------------------------------------------------------------------------------' >> "${run_x86_log_file}" LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib \ - ${run_valgrind}./net_train/net_train \ + ${run_valgrind}./benchmark_train/benchmark_train \ --modelFile=${ms_models_path}/${model_name}_train.ms \ --inDataFile=${train_io_path}/${model_name}_input1.bin,${train_io_path}/${model_name}_input2.bin \ --expectedDataFile=${train_io_path}/${model_name}_outputs.bin \ --exportFile=${ms_models_path}/${model_name}_train_exported.ms >> "${run_x86_log_file}" \ --epochs=${epoch_num} if [ $? = 0 ]; then - run_result='x86: '${model_name}'_train pass'; echo ${run_result} >> ${run_net_train_result_file} + run_result='x86: '${model_name}'_train pass'; echo ${run_result} >> ${run_benchmark_train_result_file} else - run_result='x86: '${model_name}'_train failed'; echo ${run_result} >> ${run_net_train_result_file} + run_result='x86: '${model_name}'_train failed'; echo ${run_result} >> ${run_benchmark_train_result_file} fi done < ${models_mindspore_train_config} } @@ -95,7 +95,7 @@ function Run_x86() { # Run on arm platform: # Gets a parameter - arm64/arm32 function Run_arm() { - tmp_dir=/data/local/tmp/net_train_test + tmp_dir=/data/local/tmp/benchmark_train_test if [ "$1" == arm64 ]; then arm_path=${arm64_path} process_unit="aarch64" @@ -122,34 +122,34 @@ function Run_arm() { tar -zxf mindspore-lite-${version_arm}-train-android-${process_unit}.tar.gz || exit 1 # If build with minddata, copy the minddata related libs - cd ${net_train_test_path} || exit 1 + cd ${benchmark_train_test_path} || exit 1 if [ -f ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/lib/libminddata-lite.so ]; then - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/libjpeg-turbo/lib/libjpeg.so ${net_train_test_path}/libjpeg.so || exit 1 - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/libjpeg-turbo/lib/libturbojpeg.so ${net_train_test_path}/libturbojpeg.so || exit 1 - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/opencv/lib/libopencv_core.so ${net_train_test_path}/libopencv_core.so || exit 1 - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/opencv/lib/libopencv_imgcodecs.so ${net_train_test_path}/libopencv_imgcodecs.so || exit 1 - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/opencv/lib/libopencv_imgproc.so ${net_train_test_path}/libopencv_imgproc.so || exit 1 - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/lib/libminddata-lite.so ${net_train_test_path}/libminddata-lite.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/libjpeg-turbo/lib/libjpeg.so ${benchmark_train_test_path}/libjpeg.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/libjpeg-turbo/lib/libturbojpeg.so ${benchmark_train_test_path}/libturbojpeg.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/opencv/lib/libopencv_core.so ${benchmark_train_test_path}/libopencv_core.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/opencv/lib/libopencv_imgcodecs.so ${benchmark_train_test_path}/libopencv_imgcodecs.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/opencv/lib/libopencv_imgproc.so ${benchmark_train_test_path}/libopencv_imgproc.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/lib/libminddata-lite.so ${benchmark_train_test_path}/libminddata-lite.so || exit 1 fi if [ "$1" == arm64 ]; then - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai.so ${net_train_test_path}/libhiai.so || exit 1 - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai_ir.so ${net_train_test_path}/libhiai_ir.so || exit 1 - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai_ir_build.so ${net_train_test_path}/libhiai_ir_build.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai.so ${benchmark_train_test_path}/libhiai.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai_ir.so ${benchmark_train_test_path}/libhiai_ir.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai_ir_build.so ${benchmark_train_test_path}/libhiai_ir_build.so || exit 1 fi - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/lib/libmindspore-lite.so ${net_train_test_path}/libmindspore-lite.so || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/lib/libmindspore-lite.so ${benchmark_train_test_path}/libmindspore-lite.so || exit 1 # if [ "$1" == arm64 ]; then -# cp -a ${arm_path}/mindspore-lite-${version_arm}-runtime-${arm_type}-${process_unit}-train/lib/libmindspore-lite-fp16.so ${net_train_test_path}/libmindspore-lite-fp16.so || exit 1 -# cp -a ${arm_path}/mindspore-lite-${version_arm}-runtime-${arm_type}-${process_unit}-train/lib/libmindspore-lite-optimize.so ${net_train_test_path}/libmindspore-lite-optimize.so || exit 1 +# cp -a ${arm_path}/mindspore-lite-${version_arm}-runtime-${arm_type}-${process_unit}-train/lib/libmindspore-lite-fp16.so ${benchmark_train_test_path}/libmindspore-lite-fp16.so || exit 1 +# cp -a ${arm_path}/mindspore-lite-${version_arm}-runtime-${arm_type}-${process_unit}-train/lib/libmindspore-lite-optimize.so ${benchmark_train_test_path}/libmindspore-lite-optimize.so || exit 1 # fi - cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/net_train/net_train ${net_train_test_path}/net_train || exit 1 + cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/benchmark_train/benchmark_train ${benchmark_train_test_path}/benchmark_train || exit 1 # adb push all needed files to the phone - adb -s ${device_id} push ${net_train_test_path} /data/local/tmp/ > ${adb_push_log_file} + adb -s ${device_id} push ${benchmark_train_test_path} /data/local/tmp/ > ${adb_push_log_file} # run adb ,run session ,check the result: - echo 'cd /data/local/tmp/net_train_test' > ${adb_cmd_file} - echo 'chmod 777 net_train' >> ${adb_cmd_file} + echo 'cd /data/local/tmp/benchmark_train_test' > ${adb_cmd_file} + echo 'chmod 777 benchmark_train' >> ${adb_cmd_file} adb -s ${device_id} shell < ${adb_cmd_file} @@ -160,11 +160,11 @@ function Run_arm() { continue fi - # run net_train test without clib data + # run benchmark_train test without clib data echo ${model_name}'_train' >> "${run_arm_log_file}" - adb -s ${device_id} push ${train_io_path}/${model_name}_input*.bin ${train_io_path}/${model_name}_outputs.bin /data/local/tmp/net_train_test >> ${adb_push_log_file} - echo 'cd /data/local/tmp/net_train_test' > ${adb_cmd_run_file} - echo 'chmod 777 net_train' >> ${adb_cmd_run_file} + adb -s ${device_id} push ${train_io_path}/${model_name}_input*.bin ${train_io_path}/${model_name}_outputs.bin /data/local/tmp/benchmark_train_test >> ${adb_push_log_file} + echo 'cd /data/local/tmp/benchmark_train_test' > ${adb_cmd_run_file} + echo 'chmod 777 benchmark_train' >> ${adb_cmd_run_file} if [ "$1" == arm64 ]; then echo 'cp /data/local/tmp/libc++_shared.so ./' >> ${adb_cmd_run_file} elif [ "$1" == arm32 ]; then @@ -173,7 +173,7 @@ function Run_arm() { echo "rm -f ${tmp_dir}/${model_name}_train_exported.ms" >> ${run_arm_log_file} echo "rm -f ${tmp_dir}/${model_name}_train_exported.ms" >> ${adb_cmd_run_file} adb_cmd=$(cat <<-ENDM - export LD_LIBRARY_PATH=./:/data/local/tmp/:/data/local/tmp/net_train_test;./net_train \ + export LD_LIBRARY_PATH=./:/data/local/tmp/:/data/local/tmp/benchmark_train_test;./benchmark_train \ --epochs=${epoch_num} \ --modelFile=${model_name}_train.ms \ --inDataFile=${tmp_dir}/${model_name}_input1.bin,${tmp_dir}/${model_name}_input2.bin \ @@ -186,9 +186,9 @@ ENDM adb -s ${device_id} shell < ${adb_cmd_run_file} >> ${run_arm_log_file} # TODO: change to arm_type if [ $? = 0 ]; then - run_result=$1': '${model_name}'_train pass'; echo ${run_result} >> ${run_net_train_result_file} + run_result=$1': '${model_name}'_train pass'; echo ${run_result} >> ${run_benchmark_train_result_file} else - run_result=$1': '${model_name}'_train failed'; echo ${run_result} >> ${run_net_train_result_file}; return 1 + run_result=$1': '${model_name}'_train failed'; echo ${run_result} >> ${run_benchmark_train_result_file}; return 1 fi done < ${models_mindspore_train_config} } @@ -218,7 +218,7 @@ function Print_Result() { basepath=$(pwd) echo ${basepath} -# Example:run_net_train.sh -r /home/emir/Work/TestingEnv/release -m /home/emir/Work/TestingEnv/train_models -i /home/emir/Work/TestingEnv/train_io -d "8KE5T19620002408" +# Example:run_benchmark_train.sh -r /home/emir/Work/TestingEnv/release -m /home/emir/Work/TestingEnv/train_models -i /home/emir/Work/TestingEnv/train_io -d "8KE5T19620002408" # For running on arm64, use -t to set platform tools path (for using adb commands) epoch_num=1 train_io_path="" @@ -336,9 +336,9 @@ else fi -# Write net_train result to temp file -run_net_train_result_file=${logs_path}/run_net_train_result.txt -echo ' ' > ${run_net_train_result_file} +# Write benchmark_train result to temp file +run_benchmark_train_result_file=${logs_path}/run_benchmark_train_result.txt +echo ' ' > ${run_benchmark_train_result_file} # Create log files run_x86_log_file=${logs_path}/run_x86_log.txt @@ -357,11 +357,11 @@ adb_cmd_arm32_file=${logs_path}/adb_arm32_cmd.txt adb_cmd_arm32_run_file=${logs_path}/adb_arm32_cmd_run.txt # Copy the MindSpore models: -echo "Push files to net_train_test folder and run net_train" -net_train_test_path=${basepath}/net_train_test -rm -rf ${net_train_test_path} -mkdir -p ${net_train_test_path} -cp -a ${ms_models_path}/*.ms ${net_train_test_path} || exit 1 +echo "Push files to benchmark_train_test folder and run benchmark_train" +benchmark_train_test_path=${basepath}/benchmark_train_test +rm -rf ${benchmark_train_test_path} +mkdir -p ${benchmark_train_test_path} +cp -a ${ms_models_path}/*.ms ${benchmark_train_test_path} || exit 1 # Run on x86 echo "start Run x86 ..." @@ -371,7 +371,7 @@ sleep 1 # wait ${Run_x86_PID} -cat ${run_net_train_result_file} +cat ${run_benchmark_train_result_file} wait ${Run_x86_PID} Run_x86_status=$? @@ -395,11 +395,11 @@ function Print_Benchmark_Result() { while read line; do arr=("${line}") printf "%-20s %-100s %-7s\n" ${arr[0]} ${arr[1]} ${arr[2]} - done < ${run_net_train_result_file} + done < ${run_benchmark_train_result_file} MS_PRINT_TESTCASE_END_MSG } -# Check net_train result and return value +# Check benchmark_train result and return value if [[ ${Run_x86_status} != 0 ]];then echo "Run_x86 failed" cat ${run_x86_log_file} diff --git a/mindspore/lite/tools/net_train/CMakeLists.txt b/mindspore/lite/tools/benchmark_train/CMakeLists.txt similarity index 53% rename from mindspore/lite/tools/net_train/CMakeLists.txt rename to mindspore/lite/tools/benchmark_train/CMakeLists.txt index 8653d2077d8..3b9781bfe30 100644 --- a/mindspore/lite/tools/net_train/CMakeLists.txt +++ b/mindspore/lite/tools/benchmark_train/CMakeLists.txt @@ -5,34 +5,34 @@ set(COMMON_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../src/common/utils.cc ) -add_executable(net_train +add_executable(benchmark_train ${CMAKE_CURRENT_SOURCE_DIR}/main.cc ${CMAKE_CURRENT_SOURCE_DIR}/net_train.cc ${COMMON_SRC}) if (WIN32) - add_dependencies(net_train fbs_src mindspore-lite_static) + add_dependencies(benchmark_train fbs_src mindspore-lite_static) else () - add_dependencies(net_train fbs_src) + add_dependencies(benchmark_train fbs_src) endif () if (PLATFORM_ARM32 OR PLATFORM_ARM64) - target_link_libraries(net_train mindspore-lite) + target_link_libraries(benchmark_train mindspore-lite) else() if (WIN32) - target_link_libraries(net_train mindspore-lite_static pthread cpu_kernel_mid nnacl_mid) + target_link_libraries(benchmark_train mindspore-lite_static pthread cpu_kernel_mid nnacl_mid) else () - target_link_libraries(net_train mindspore-lite pthread) + target_link_libraries(benchmark_train mindspore-lite pthread) endif () endif() if (PLATFORM_ARM32 OR PLATFORM_ARM64) - install(TARGETS net_train - RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/net_train COMPONENT ${RUNTIME_COMPONENT_NAME}) + install(TARGETS benchmark_train + RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/benchmark_train COMPONENT ${RUNTIME_COMPONENT_NAME}) else() if (WIN32) - install(TARGETS net_train - RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/net_train COMPONENT ${RUNTIME_COMPONENT_NAME}) + install(TARGETS benchmark_train + RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/benchmark_train COMPONENT ${RUNTIME_COMPONENT_NAME}) else () - install(TARGETS net_train - RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/net_train COMPONENT ${RUNTIME_COMPONENT_NAME}) + install(TARGETS benchmark_train + RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/benchmark_train COMPONENT ${RUNTIME_COMPONENT_NAME}) endif () endif() diff --git a/mindspore/lite/tools/net_train/main.cc b/mindspore/lite/tools/benchmark_train/main.cc similarity index 95% rename from mindspore/lite/tools/net_train/main.cc rename to mindspore/lite/tools/benchmark_train/main.cc index cfde9d319f1..b0fe36bc99d 100644 --- a/mindspore/lite/tools/net_train/main.cc +++ b/mindspore/lite/tools/benchmark_train/main.cc @@ -15,7 +15,7 @@ */ #include -#include "tools/net_train/net_train.h" +#include "tools/benchmark_train/net_train.h" #include "include/version.h" int main(int argc, const char **argv) { diff --git a/mindspore/lite/tools/net_train/net_train.cc b/mindspore/lite/tools/benchmark_train/net_train.cc similarity index 99% rename from mindspore/lite/tools/net_train/net_train.cc rename to mindspore/lite/tools/benchmark_train/net_train.cc index ed7ac92a93e..ec5a14732b0 100644 --- a/mindspore/lite/tools/net_train/net_train.cc +++ b/mindspore/lite/tools/benchmark_train/net_train.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "tools/net_train/net_train.h" +#include "tools/benchmark_train/net_train.h" #define __STDC_FORMAT_MACROS #include #undef __STDC_FORMAT_MACROS diff --git a/mindspore/lite/tools/net_train/net_train.h b/mindspore/lite/tools/benchmark_train/net_train.h similarity index 100% rename from mindspore/lite/tools/net_train/net_train.h rename to mindspore/lite/tools/benchmark_train/net_train.h diff --git a/mindspore/lite/tools/converter/converter.cc b/mindspore/lite/tools/converter/converter.cc index 49400aaa52b..ce5ba7829df 100644 --- a/mindspore/lite/tools/converter/converter.cc +++ b/mindspore/lite/tools/converter/converter.cc @@ -67,6 +67,9 @@ MetaGraphT *Converter::Convert(const converter::Flags *flag) { int status = modelImporter->Import(flag); ReturnCode::GetSingleReturnCode()->UpdateReturnCode(status); graph = modelImporter->GetResult(); + if (graph == nullptr) { + return nullptr; + } graph->set_attr("graph_name", MakeValue("main_graph")); } else { MS_ASSERT(nullptr != modelParser); diff --git a/scripts/lite_release_package.sh b/scripts/lite_release_package.sh index 0d190175be9..ec63442c59b 100644 --- a/scripts/lite_release_package.sh +++ b/scripts/lite_release_package.sh @@ -80,12 +80,12 @@ function android_release_package() if [ ${name} == "train" ] then - mkdir -p ${dst_android_pkg_name}/net_train/aarch64/ - mkdir -p ${dst_android_pkg_name}/net_train/aarch32/ + mkdir -p ${dst_android_pkg_name}/benchmark_train/aarch64/ + mkdir -p ${dst_android_pkg_name}/benchmark_train/aarch32/ mkdir -p ${dst_android_pkg_name}/minddata/third_party/libjpeg-turbo/lib/aarch64/ mkdir -p ${dst_android_pkg_name}/minddata/third_party/libjpeg-turbo/lib/aarch32/ - cp ${src_arm64_pkg_name}/net_train/* ${dst_android_pkg_name}/net_train/aarch64/ - cp ${src_arm32_pkg_name}/net_train/* ${dst_android_pkg_name}/net_train/aarch32/ + cp ${src_arm64_pkg_name}/benchmark_train/* ${dst_android_pkg_name}/benchmark_train/aarch64/ + cp ${src_arm32_pkg_name}/benchmark_train/* ${dst_android_pkg_name}/benchmark_train/aarch32/ cp ${src_arm64_pkg_name}/minddata/third_party/libjpeg-turbo/lib/* ${dst_android_pkg_name}/minddata/third_party/libjpeg-turbo/lib/aarch64/ cp ${src_arm32_pkg_name}/minddata/third_party/libjpeg-turbo/lib/* ${dst_android_pkg_name}/minddata/third_party/libjpeg-turbo/lib/aarch32/ fi