From 24b57c222e73f2fad5c873864422742cef57d406 Mon Sep 17 00:00:00 2001 From: liuwenhao4 Date: Sat, 29 Aug 2020 14:04:50 +0800 Subject: [PATCH] Fix a tiny mistake of split ops --- build.bat | 26 +++++++++---------- .../src/runtime/kernel/arm/base/split_base.cc | 6 ++++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/build.bat b/build.bat index e26019015bb..dff968dc401 100644 --- a/build.bat +++ b/build.bat @@ -20,14 +20,14 @@ IF NOT EXIST "%BASEPATH%/build" ( md "build" ) -cd "%BASEPATH%/build" +cd %BASEPATH%/build set BUILD_PATH=%CD% IF NOT EXIST "%BUILD_PATH%/mindspore" ( md "mindspore" ) -cd "%CD%/mindspore" +cd %CD%/mindspore IF "%1%" == "lite" ( call :gene_gtest @@ -56,7 +56,7 @@ IF "%1%" == "lite" ( echo "build fail." goto run_fail ) ELSE ( - cd "%BASEPATH%/output" + cd %BASEPATH%/output rd /s /q _CPack_Packages ) ) ELSE ( @@ -78,22 +78,22 @@ IF "%1%" == "lite" ( ) ) -cd "%BASEPATH%" +cd %BASEPATH% goto run_eof :run_cmake - cd "%BUILD_PATH%/mindspore" + cd %BUILD_PATH%/mindspore cmake -DBUILD_DEVICE=on -DBUILD_CONVERTER=on -DPLATFORM_ARM64=off -DSUPPORT_TRAIN=off ^ -DCMAKE_BUILD_TYPE=Release -DSUPPORT_GPU=off -DBUILD_MINDDATA=off -DOFFLINE_COMPILE=off ^ -G "CodeBlocks - MinGW Makefiles" "%BASEPATH%/mindspore/lite" GOTO:EOF :gene_gtest - cd "%BASEPATH%/third_party" + cd %BASEPATH%/third_party IF EXIST googletest rd /s /q googletest git submodule update --init --recursive googletest - cd "%BUILD_PATH%/mindspore" + cd %BUILD_PATH%/mindspore GOTO:EOF :gene_protobuf @@ -111,22 +111,22 @@ GOTO:EOF :gene_flatbuffer SET FLATC="%BASEPATH%/build/mindspore/_deps/flatbuffers-src/_build/flatc" - SET FLAT_DIR="%BASEPATH%/mindspore/lite/schema" + SET FLAT_DIR=%BASEPATH%/mindspore/lite/schema cd %FLAT_DIR% IF EXIST inner rd /s /q inner md inner %FLATC% -c -b *.fbs - %FLATC% -c -b --reflect-types --gen-mutable --reflect-names --gen-object-api -o %FLAT_DIR%/inner *.fbs + %FLATC% -c -b --reflect-types --gen-mutable --reflect-names --gen-object-api -o "%FLAT_DIR%/inner" *.fbs - SET FLAT_DIR="%BASEPATH%/mindspore/lite/tools/converter/parser/tflite" + SET FLAT_DIR=%BASEPATH%/mindspore/lite/tools/converter/parser/tflite cd %FLAT_DIR% - %FLATC% -c -b --reflect-types --gen-mutable --reflect-names --gen-object-api -o %FLAT_DIR% *.fbs - cd "%BUILD_PATH%/mindspore" + %FLATC% -c -b --reflect-types --gen-mutable --reflect-names --gen-object-api -o "%FLAT_DIR%" *.fbs + cd %BUILD_PATH%/mindspore GOTO:EOF :run_fail - cd "%BASEPATH%" + cd %BASEPATH% set errorlevel=1 :run_eof diff --git a/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc index 7abcfe010c3..5c0ad059cf6 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc @@ -28,7 +28,11 @@ using mindspore::lite::RET_OK; using mindspore::schema::PrimitiveType_Split; namespace mindspore::kernel { -int SplitBaseCPUKernel::Init() { return RET_OK; } +int SplitBaseCPUKernel::Init() { + auto split_dim = param->split_dim_; + param->split_dim_ = split_dim >= 0 ? split_dim : in_tensors_.front()->shape().size() + split_dim; + return RET_OK; +} int SplitBaseCPUKernel::ReSize() { auto in_tensor = in_tensors_.front();