diff --git a/mindspore/lite/examples/train_lenet/prepare_and_run.sh b/mindspore/lite/examples/train_lenet/prepare_and_run.sh index 3d7c2a3bbc..ae35b75c8a 100755 --- a/mindspore/lite/examples/train_lenet/prepare_and_run.sh +++ b/mindspore/lite/examples/train_lenet/prepare_and_run.sh @@ -199,10 +199,17 @@ else cd ${PACKAGE} || exit 1 echo "======Training Locally=========" ./train.sh ${EPOCHS} + if [ "$?" != "0" ]; then + echo "Training Model failed" + exit 1 + fi echo "===Evaluating trained Model=====" ./eval.sh - + if [ "$?" != "0" ]; then + echo "Eval Model failed" + exit 1 + fi cd .. fi END=$(date +%s.%N) diff --git a/mindspore/lite/examples/train_lenet_java/prepare_and_run.sh b/mindspore/lite/examples/train_lenet_java/prepare_and_run.sh index 66557812f0..ba27bdd485 100755 --- a/mindspore/lite/examples/train_lenet_java/prepare_and_run.sh +++ b/mindspore/lite/examples/train_lenet_java/prepare_and_run.sh @@ -58,6 +58,10 @@ if [ "$MNIST_DATA_PATH" == "" ] || [ ! -d "$MNIST_DATA_PATH" ]; then fi ./build.sh $TARBALL +if [ "$?" != "0" ]; then + echo "build failed on $TARBALL" + exit 1 +fi BASEPATH=$(cd "$(dirname $0)" || exit; pwd) diff --git a/mindspore/lite/examples/transfer_learning/prepare_and_run.sh b/mindspore/lite/examples/transfer_learning/prepare_and_run.sh index 02071adc6a..b295b6be03 100755 --- a/mindspore/lite/examples/transfer_learning/prepare_and_run.sh +++ b/mindspore/lite/examples/transfer_learning/prepare_and_run.sh @@ -140,12 +140,24 @@ else cd ${PACKAGE} || exit 1 echo "==Evaluating Untrained Model===" ./eval_untrained.sh + if [ "$?" != "0" ]; then + echo "Evaluating Untrained Model failed" + exit 1 + fi echo "======Training Locally=========" ./train.sh + if [ "$?" != "0" ]; then + echo "Training Model failed" + exit 1 + fi echo "===Evaluating trained Model=====" ./eval.sh + if [ "$?" != "0" ]; then + echo "Eval Model failed" + exit 1 + fi cd .. fi diff --git a/mindspore/lite/examples/unified_api/prepare_and_run.sh b/mindspore/lite/examples/unified_api/prepare_and_run.sh index 7bf20b23c6..3358ca75d1 100755 --- a/mindspore/lite/examples/unified_api/prepare_and_run.sh +++ b/mindspore/lite/examples/unified_api/prepare_and_run.sh @@ -175,12 +175,24 @@ else cd ${PACKAGE} || exit 1 echo "======Training Locally=========" ./train.sh ${EPOCHS} + if [ "$?" != "0" ]; then + echo "Training Model failed" + exit 1 + fi echo "===Evaluating trained Model=====" ./eval.sh + if [ "$?" != "0" ]; then + echo "Eval Model failed" + exit 1 + fi echo "====Running Inference Model=====" ./infer.sh + if [ "$?" != "0" ]; then + echo "Running Inference Model failed" + exit 1 + fi cd .. fi diff --git a/mindspore/lite/examples/unified_api/scripts/infer.sh b/mindspore/lite/examples/unified_api/scripts/infer.sh index 1d8006b1fd..35d441d071 100755 --- a/mindspore/lite/examples/unified_api/scripts/infer.sh +++ b/mindspore/lite/examples/unified_api/scripts/infer.sh @@ -16,3 +16,7 @@ # an simple tutorial as follows, more parameters can be setting LD_LIBRARY_PATH=./lib/ bin/infer -f model/lenet_tod_infer.ms +if [ "$?" != "0" ]; then + echo "Infer failed" + exit 1 +fi diff --git a/mindspore/lite/examples/unified_api/src/inference.cc b/mindspore/lite/examples/unified_api/src/inference.cc index 23d133c79b..b60871cc0d 100644 --- a/mindspore/lite/examples/unified_api/src/inference.cc +++ b/mindspore/lite/examples/unified_api/src/inference.cc @@ -80,6 +80,7 @@ int main(int argc, char **argv) { std::cout << "]" << std::endl; } + inputs.at(0).MutableData(); mindspore::MSTensor *input_tensor = inputs.at(0).Clone(); auto *input_data = reinterpret_cast(input_tensor->MutableData()); std::ifstream in; diff --git a/mindspore/lite/test/st/scripts/run_net_train.sh b/mindspore/lite/test/st/scripts/run_net_train.sh index 5b087693ee..7ea2abddbe 100755 --- a/mindspore/lite/test/st/scripts/run_net_train.sh +++ b/mindspore/lite/test/st/scripts/run_net_train.sh @@ -1,6 +1,6 @@ #!/bin/bash source ./scripts/base_functions.sh -version=1.3.0 +version=1.5.0 # Run Export on x86 platform and create output test files: docker_image=mindspore_build:210301 @@ -412,6 +412,10 @@ function Run_CodeExamples() { cd ${basepath}/../../examples/train_lenet_java || exit 1 chmod 777 ./prepare_and_run.sh ./prepare_and_run.sh -D ${datasets_path}/mnist -r ${tarball_path} -m ${models_path}/code_example.mindir >> ${run_code_examples_log_file} + if [ "$?" != "0" ]; then + echo "train_lenet_java prepare_and_run.sh failed" + exit 1 + fi accurate=$(tail -10 ${run_code_examples_log_file} | awk -F= 'NF==2 && /accuracy/ { sum += $2} END { print (sum > 0.80) }') if [ $accurate -eq 1 ]; then echo "Lenet Java Trained and reached accuracy" >> ${run_code_examples_log_file} @@ -431,6 +435,10 @@ function Run_CodeExamples() { chmod 777 ./prepare_and_run.sh chmod 777 ./*/*.sh ./prepare_and_run.sh -D ${datasets_path}/mnist -r ${tarball_path} -t ${target} -m ${models_path}/code_example.mindir -e 1 >> ${run_code_examples_log_file} + if [ "$?" != "0" ]; then + echo "Unified API prepare_and_run.sh failed" + exit 1 + fi accurate=$(tail -20 ${run_code_examples_log_file} | awk 'NF==3 && /Accuracy is/ { sum += $3} END { print (sum > 1.6) }') if [ $accurate -eq 1 ]; then echo "Unified API Trained and reached accuracy" >> ${run_code_examples_log_file} @@ -451,6 +459,10 @@ function Run_CodeExamples() { chmod 777 ./prepare_and_run.sh chmod 777 ./*/*.sh ./prepare_and_run.sh -D ${datasets_path}/mnist -r ${tarball_path} -t ${target} -m ${models_path}/code_example.mindir -e 1 >> ${run_code_examples_log_file} + if [ "$?" != "0" ]; then + echo "train_lenet prepare_and_run.sh failed" + exit 1 + fi accurate=$(tail -10 ${run_code_examples_log_file} | awk 'NF==3 && /Accuracy is/ { sum += $3} END { print (sum > 1.6) }') if [ $accurate -eq 1 ]; then echo "Lenet Trained and reached accuracy" >> ${run_code_examples_log_file}