diff --git a/build.sh b/build.sh index c72450fdc1..f042a98ada 100755 --- a/build.sh +++ b/build.sh @@ -115,6 +115,7 @@ checkopts() ENABLE_CONVERTER="on" LITE_LANGUAGE="cpp" ENABLE_GITEE="off" + ANDROID_STL="c++_shared" # Process the options while getopts 'drvj:c:t:hsb:a:g:p:ie:m:l:I:LRP:D:zM:V:K:swB:En:T:A:C:o:S:' opt @@ -313,9 +314,11 @@ checkopts() COMPILE_LITE="on" if [[ "$OPTARG" == "cpp" ]]; then LITE_LANGUAGE="cpp" + ANDROID_STL="c++_shared" elif [[ "$OPTARG" == "java" ]]; then LITE_LANGUAGE="java" ENABLE_CONVERTER="off" + ANDROID_STL="c++_static" elif [[ "$OPTARG" == "object-c" ]]; then LITE_LANGUAGE="object-c" else @@ -669,7 +672,7 @@ build_lite() checkndk cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_NATIVE_API_LEVEL="19" \ -DANDROID_NDK="${ANDROID_NDK}" -DANDROID_ABI="arm64-v8a" -DANDROID_TOOLCHAIN_NAME="aarch64-linux-android-clang" \ - -DANDROID_STL="c++_static" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \ + -DANDROID_STL=${ANDROID_STL} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \ -DPLATFORM_ARM64=on -DENABLE_NEON=on -DENABLE_FP16="off" \ -DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} -DBUILD_TESTCASES=${RUN_TESTCASES} \ -DSUPPORT_GPU=${ENABLE_GPU} -DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \ @@ -680,7 +683,7 @@ build_lite() checkndk cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_NATIVE_API_LEVEL="19" \ -DANDROID_NDK="${ANDROID_NDK}" -DANDROID_ABI="armeabi-v7a" -DANDROID_TOOLCHAIN_NAME="clang" \ - -DANDROID_STL="c++_static" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DANDROID_STL=${ANDROID_STL} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DPLATFORM_ARM32=on -DENABLE_NEON=on -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \ -DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} -DBUILD_TESTCASES=${RUN_TESTCASES} \ -DSUPPORT_GPU=${ENABLE_GPU} -DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \ diff --git a/mindspore/lite/nnacl/int8/common_func.c b/mindspore/lite/nnacl/int8/common_func_int8.c similarity index 98% rename from mindspore/lite/nnacl/int8/common_func.c rename to mindspore/lite/nnacl/int8/common_func_int8.c index beedc410ee..fce0e50b3d 100644 --- a/mindspore/lite/nnacl/int8/common_func.c +++ b/mindspore/lite/nnacl/int8/common_func_int8.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "nnacl/int8/common_func.h" +#include "nnacl/int8/common_func_int8.h" #include "nnacl/quantization/fixed_point.h" void PostConvFuncCommInt8(const int32_t *in, int8_t *out, const int32_t *bias, size_t oc, size_t plane, diff --git a/mindspore/lite/nnacl/int8/common_func.h b/mindspore/lite/nnacl/int8/common_func_int8.h similarity index 100% rename from mindspore/lite/nnacl/int8/common_func.h rename to mindspore/lite/nnacl/int8/common_func_int8.h diff --git a/mindspore/lite/nnacl/int8/conv_depthwise_int8.c b/mindspore/lite/nnacl/int8/conv_depthwise_int8.c index e1046d3eeb..587d5e6485 100644 --- a/mindspore/lite/nnacl/int8/conv_depthwise_int8.c +++ b/mindspore/lite/nnacl/int8/conv_depthwise_int8.c @@ -17,7 +17,7 @@ #include "nnacl/int8/conv_depthwise_int8.h" #include #include "nnacl/quantization/fixed_point.h" -#include "nnacl/int8/common_func.h" +#include "nnacl/int8/common_func_int8.h" /*conv depthwise int8 begin*/ #ifndef ENABLE_ARM diff --git a/mindspore/lite/nnacl/int8/conv_int8.c b/mindspore/lite/nnacl/int8/conv_int8.c index 384bb2352b..3794cbdc16 100644 --- a/mindspore/lite/nnacl/int8/conv_int8.c +++ b/mindspore/lite/nnacl/int8/conv_int8.c @@ -17,7 +17,7 @@ #include "nnacl/int8/conv_int8.h" #include #include "nnacl/winograd_transform.h" -#include "nnacl/int8/common_func.h" +#include "nnacl/int8/common_func_int8.h" void Conv3x3Int8Gemm(int32_t *dst, const int16_t *src, const int16_t *weight, int oc, int ic8, size_t real_cal_num) { int oc4 = UP_DIV(oc, C4NUM); diff --git a/mindspore/lite/nnacl/int8/deconv.c b/mindspore/lite/nnacl/int8/deconv_int8.c similarity index 99% rename from mindspore/lite/nnacl/int8/deconv.c rename to mindspore/lite/nnacl/int8/deconv_int8.c index 2195f2728b..9c6fba7841 100644 --- a/mindspore/lite/nnacl/int8/deconv.c +++ b/mindspore/lite/nnacl/int8/deconv_int8.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "nnacl/int8/deconv.h" +#include "nnacl/int8/deconv_int8.h" #include "nnacl/int8/matmul_int8.h" -#include "nnacl/int8/common_func.h" +#include "nnacl/int8/common_func_int8.h" int DeConvPostInt8C8(const int32_t *src, const int32_t *bias, int32_t *tmp, int8_t *out, int output_channel, ConvParameter *conv_param) { /* row8x8-major(ih*iw x oc*kh*kw) -> row8-major(oh*ow x oc) */ diff --git a/mindspore/lite/nnacl/int8/deconv.h b/mindspore/lite/nnacl/int8/deconv_int8.h similarity index 100% rename from mindspore/lite/nnacl/int8/deconv.h rename to mindspore/lite/nnacl/int8/deconv_int8.h diff --git a/mindspore/lite/nnacl/int8/pad.c b/mindspore/lite/nnacl/int8/pad_int8.c similarity index 98% rename from mindspore/lite/nnacl/int8/pad.c rename to mindspore/lite/nnacl/int8/pad_int8.c index f1da8c1f83..5239212553 100644 --- a/mindspore/lite/nnacl/int8/pad.c +++ b/mindspore/lite/nnacl/int8/pad_int8.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "nnacl/int8/pad.h" +#include "nnacl/int8/pad_int8.h" #include "nnacl/common_func.h" #include "nnacl/errorcode.h" diff --git a/mindspore/lite/nnacl/int8/pad.h b/mindspore/lite/nnacl/int8/pad_int8.h similarity index 100% rename from mindspore/lite/nnacl/int8/pad.h rename to mindspore/lite/nnacl/int8/pad_int8.h diff --git a/mindspore/lite/nnacl/int8/quant_dtype_cast.c b/mindspore/lite/nnacl/int8/quant_dtype_cast_int8.c similarity index 98% rename from mindspore/lite/nnacl/int8/quant_dtype_cast.c rename to mindspore/lite/nnacl/int8/quant_dtype_cast_int8.c index 1e8e7d7986..ad532d57fa 100644 --- a/mindspore/lite/nnacl/int8/quant_dtype_cast.c +++ b/mindspore/lite/nnacl/int8/quant_dtype_cast_int8.c @@ -15,7 +15,7 @@ */ #include -#include "nnacl/int8/quant_dtype_cast.h" +#include "nnacl/int8/quant_dtype_cast_int8.h" #include "nnacl/errorcode.h" int DoDequantizeInt8ToFp32(int8_t *quant_values, float *real_values, float scale, int32_t zp, int size) { diff --git a/mindspore/lite/nnacl/int8/quant_dtype_cast.h b/mindspore/lite/nnacl/int8/quant_dtype_cast_int8.h similarity index 100% rename from mindspore/lite/nnacl/int8/quant_dtype_cast.h rename to mindspore/lite/nnacl/int8/quant_dtype_cast_int8.h diff --git a/mindspore/lite/nnacl/int8/resize.c b/mindspore/lite/nnacl/int8/resize_int8.c similarity index 99% rename from mindspore/lite/nnacl/int8/resize.c rename to mindspore/lite/nnacl/int8/resize_int8.c index 2f10130738..84d937f5a6 100644 --- a/mindspore/lite/nnacl/int8/resize.c +++ b/mindspore/lite/nnacl/int8/resize_int8.c @@ -14,7 +14,7 @@ * limitations under the License. */ #include -#include "nnacl/int8/resize.h" +#include "nnacl/int8/resize_int8.h" #include "nnacl/common_func.h" #include "nnacl/quantization/fixed_point.h" #include "nnacl/errorcode.h" diff --git a/mindspore/lite/nnacl/int8/resize.h b/mindspore/lite/nnacl/int8/resize_int8.h similarity index 100% rename from mindspore/lite/nnacl/int8/resize.h rename to mindspore/lite/nnacl/int8/resize_int8.h diff --git a/mindspore/lite/src/ops/populate/add_populate.cc b/mindspore/lite/src/ops/populate/add_populate.cc new file mode 100644 index 0000000000..05119f7b3d --- /dev/null +++ b/mindspore/lite/src/ops/populate/add_populate.cc @@ -0,0 +1,37 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "src/ops/add.h" +#include "src/ops/primitive_c.h" +#include "src/ops/populate/populate_register.h" +#include "nnacl/arithmetic_common.h" +#include "src/ops/populate/arithmetic_populate.h" + +namespace mindspore { +namespace lite { +OpParameter *PopulateAddParameter(const mindspore::lite::PrimitiveC *primitive) { + ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); + if (param == nullptr) { + MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; + return nullptr; + } + param->activation_type_ = reinterpret_cast(primitive)->GetActivationType(); + return reinterpret_cast(param); +} +Registry AddParameterRegistry(schema::PrimitiveType_Add, PopulateAddParameter); + +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/src/ops/populate/arithmetic_populate.cc b/mindspore/lite/src/ops/populate/arithmetic_populate.cc index 29456c07ab..196959ef73 100644 --- a/mindspore/lite/src/ops/populate/arithmetic_populate.cc +++ b/mindspore/lite/src/ops/populate/arithmetic_populate.cc @@ -13,13 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include "src/ops/populate/arithmetic_populate.h" #include "src/ops/arithmetic.h" -#include "src/ops/add.h" -#include "src/ops/sub.h" -#include "src/ops/mul.h" -#include "src/ops/div.h" -#include "src/ops/eltwise.h" -#include "src/ops/greater_equal.h" #include "src/common/log_adapter.h" #include "src/tensor.h" #include "src/ops/primitive_c.h" @@ -27,6 +23,7 @@ namespace mindspore { namespace lite { + ArithmeticParameter *PopulateArithmeticCommonPara(const mindspore::lite::PrimitiveC *primitive) { ArithmeticParameter *param = reinterpret_cast(malloc(sizeof(ArithmeticParameter))); if (param == nullptr) { @@ -57,70 +54,6 @@ OpParameter *PopulateArithmetic(const mindspore::lite::PrimitiveC *primitive) { return reinterpret_cast(param); } -OpParameter *PopulateAddParameter(const mindspore::lite::PrimitiveC *primitive) { - ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); - if (param == nullptr) { - MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; - return nullptr; - } - param->activation_type_ = reinterpret_cast(primitive)->GetActivationType(); - return reinterpret_cast(param); -} - -OpParameter *PopulateSubParameter(const mindspore::lite::PrimitiveC *primitive) { - ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); - if (param == nullptr) { - MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; - return nullptr; - } - param->activation_type_ = reinterpret_cast(primitive)->GetActivationType(); - return reinterpret_cast(param); -} - -OpParameter *PopulateMulParameter(const mindspore::lite::PrimitiveC *primitive) { - ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); - if (param == nullptr) { - MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; - return nullptr; - } - param->activation_type_ = reinterpret_cast(primitive)->GetActivationType(); - return reinterpret_cast(param); -} - -OpParameter *PopulateDivParameter(const mindspore::lite::PrimitiveC *primitive) { - ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); - if (param == nullptr) { - MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; - return nullptr; - } - param->activation_type_ = reinterpret_cast(primitive)->GetActivationType(); - return reinterpret_cast(param); -} - -OpParameter *PopulateEltwiseParameter(const mindspore::lite::PrimitiveC *primitive) { - ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); - if (param == nullptr) { - MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; - return nullptr; - } - auto eltwise = reinterpret_cast(primitive); - switch (eltwise->GetMode()) { - case schema::EltwiseMode_PROD: - param->op_parameter_.type_ = schema::PrimitiveType_Mul; - break; - case schema::EltwiseMode_SUM: - param->op_parameter_.type_ = schema::PrimitiveType_Add; - break; - case schema::EltwiseMode_MAXIMUM: - param->op_parameter_.type_ = schema::PrimitiveType_Maximum; - break; - default: - free(param); - return nullptr; - } - return reinterpret_cast(param); -} - Registry RealDivParameterRegistry(schema::PrimitiveType_RealDiv, PopulateArithmetic); Registry LogicalAndParameterRegistry(schema::PrimitiveType_LogicalAnd, PopulateArithmetic); Registry ParameterRegistry(schema::PrimitiveType_LogicalOr, PopulateArithmetic); @@ -135,10 +68,5 @@ Registry MinimumParameterRegistry(schema::PrimitiveType_Minimum, PopulateArithme Registry FloorDivParameterRegistry(schema::PrimitiveType_FloorDiv, PopulateArithmetic); Registry FloorModParameterRegistry(schema::PrimitiveType_FloorMod, PopulateArithmetic); Registry SquaredDifferenceParameterRegistry(schema::PrimitiveType_SquaredDifference, PopulateArithmetic); -Registry AddParameterRegistry(schema::PrimitiveType_Add, PopulateAddParameter); -Registry SubParameterRegistry(schema::PrimitiveType_Sub, PopulateSubParameter); -Registry MulParameterRegistry(schema::PrimitiveType_Mul, PopulateMulParameter); -Registry DivParameterRegistry(schema::PrimitiveType_Div, PopulateDivParameter); -Registry EltwiseParameterRegistry(schema::PrimitiveType_Eltwise, PopulateEltwiseParameter); } // namespace lite } // namespace mindspore diff --git a/mindspore/lite/src/ops/populate/arithmetic_populate.h b/mindspore/lite/src/ops/populate/arithmetic_populate.h new file mode 100644 index 0000000000..7309361d5b --- /dev/null +++ b/mindspore/lite/src/ops/populate/arithmetic_populate.h @@ -0,0 +1,23 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "src/ops/arithmetic.h" + +namespace mindspore { +namespace lite { +ArithmeticParameter *PopulateArithmeticCommonPara(const mindspore::lite::PrimitiveC *primitive); +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/src/ops/populate/div_populate.cc b/mindspore/lite/src/ops/populate/div_populate.cc new file mode 100644 index 0000000000..78af04ef10 --- /dev/null +++ b/mindspore/lite/src/ops/populate/div_populate.cc @@ -0,0 +1,37 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "src/ops/div.h" +#include "src/ops/primitive_c.h" +#include "src/ops/populate/populate_register.h" +#include "src/ops/populate/arithmetic_populate.h" +namespace mindspore { +namespace lite { + +OpParameter *PopulateDivParameter(const mindspore::lite::PrimitiveC *primitive) { + ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); + if (param == nullptr) { + MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; + return nullptr; + } + param->activation_type_ = reinterpret_cast(primitive)->GetActivationType(); + return reinterpret_cast(param); +} + +Registry DivParameterRegistry(schema::PrimitiveType_Div, PopulateDivParameter); + +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/src/ops/populate/eltwise_populate.cc b/mindspore/lite/src/ops/populate/eltwise_populate.cc new file mode 100644 index 0000000000..b3efabb77f --- /dev/null +++ b/mindspore/lite/src/ops/populate/eltwise_populate.cc @@ -0,0 +1,52 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "src/ops/div.h" +#include "src/ops/eltwise.h" +#include "src/ops/primitive_c.h" +#include "src/ops/populate/populate_register.h" +#include "src/ops/populate/arithmetic_populate.h" +namespace mindspore { +namespace lite { + +OpParameter *PopulateEltwiseParameter(const mindspore::lite::PrimitiveC *primitive) { + ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); + if (param == nullptr) { + MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; + return nullptr; + } + auto eltwise = reinterpret_cast(primitive); + switch (eltwise->GetMode()) { + case schema::EltwiseMode_PROD: + param->op_parameter_.type_ = schema::PrimitiveType_Mul; + break; + case schema::EltwiseMode_SUM: + param->op_parameter_.type_ = schema::PrimitiveType_Add; + break; + case schema::EltwiseMode_MAXIMUM: + param->op_parameter_.type_ = schema::PrimitiveType_Maximum; + break; + default: + free(param); + return nullptr; + } + return reinterpret_cast(param); +} + +Registry EltwiseParameterRegistry(schema::PrimitiveType_Eltwise, PopulateEltwiseParameter); + +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/src/ops/populate/mul_populate.cc b/mindspore/lite/src/ops/populate/mul_populate.cc new file mode 100644 index 0000000000..f33dc24ff1 --- /dev/null +++ b/mindspore/lite/src/ops/populate/mul_populate.cc @@ -0,0 +1,39 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "src/ops/mul.h" +#include "nnacl/arithmetic_common.h" +#include "src/ops/primitive_c.h" +#include "src/ops/populate/populate_register.h" +#include "src/ops/populate/arithmetic_populate.h" + +namespace mindspore { +namespace lite { + +OpParameter *PopulateMulParameter(const mindspore::lite::PrimitiveC *primitive) { + ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); + if (param == nullptr) { + MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; + return nullptr; + } + param->activation_type_ = reinterpret_cast(primitive)->GetActivationType(); + return reinterpret_cast(param); +} + +Registry MulParameterRegistry(schema::PrimitiveType_Mul, PopulateMulParameter); + +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/src/ops/populate/quant_dtype_cast_populate.cc b/mindspore/lite/src/ops/populate/quant_dtype_cast_populate.cc index a7fa86eef4..b91238ea39 100644 --- a/mindspore/lite/src/ops/populate/quant_dtype_cast_populate.cc +++ b/mindspore/lite/src/ops/populate/quant_dtype_cast_populate.cc @@ -17,7 +17,7 @@ #include "src/ops/quant_dtype_cast.h" #include "src/ops/primitive_c.h" #include "src/ops/populate/populate_register.h" -#include "nnacl/int8/quant_dtype_cast.h" +#include "nnacl/int8/quant_dtype_cast_int8.h" namespace mindspore { namespace lite { diff --git a/mindspore/lite/src/ops/populate/sub_populate.cc b/mindspore/lite/src/ops/populate/sub_populate.cc new file mode 100644 index 0000000000..b3d38a3776 --- /dev/null +++ b/mindspore/lite/src/ops/populate/sub_populate.cc @@ -0,0 +1,39 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "src/ops/sub.h" +#include "src/ops/primitive_c.h" +#include "src/ops/populate/populate_register.h" +#include "nnacl/arithmetic_common.h" +#include "src/ops/populate/arithmetic_populate.h" + +namespace mindspore { +namespace lite { + +OpParameter *PopulateSubParameter(const mindspore::lite::PrimitiveC *primitive) { + ArithmeticParameter *param = PopulateArithmeticCommonPara(primitive); + if (param == nullptr) { + MS_LOG(ERROR) << "PopulateArithmeticCommonPara failed."; + return nullptr; + } + param->activation_type_ = reinterpret_cast(primitive)->GetActivationType(); + return reinterpret_cast(param); +} + +Registry SubParameterRegistry(schema::PrimitiveType_Sub, PopulateSubParameter); + +} // namespace lite +} // namespace mindspore diff --git a/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc index 6835af5c6b..b470ae6e3b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc @@ -18,7 +18,7 @@ #include "schema/model_generated.h" #include "src/kernel_registry.h" #include "include/errorcode.h" -#include "nnacl/int8/quant_dtype_cast.h" +#include "nnacl/int8/quant_dtype_cast_int8.h" using mindspore::kernel::KERNEL_ARCH::kCPU; using mindspore::lite::RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.cc b/mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.cc index c9053bf79d..d6fb0f919c 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.cc @@ -15,7 +15,7 @@ */ #include "src/runtime/kernel/arm/base/quant_dtype_cast.h" #include -#include "nnacl/int8/quant_dtype_cast.h" +#include "nnacl/int8/quant_dtype_cast_int8.h" #include "src/runtime/runtime_api.h" #include "src/kernel_registry.h" #include "schema/model_generated.h" diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.cc index 562c1c9790..f6f9d435fa 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.cc @@ -15,7 +15,7 @@ */ #include "src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.h" #include -#include "nnacl/int8/quant_dtype_cast.h" +#include "nnacl/int8/quant_dtype_cast_int8.h" #include "nnacl/fp16/quant_dtype_cast_fp16.h" #include "src/runtime/runtime_api.h" #include "src/kernel_registry.h" diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/detection_post_process.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/detection_post_process.cc index 00d8aa433d..f9118a7758 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/detection_post_process.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/detection_post_process.cc @@ -18,7 +18,7 @@ #include "schema/model_generated.h" #include "src/kernel_registry.h" #include "include/errorcode.h" -#include "nnacl/int8/quant_dtype_cast.h" +#include "nnacl/int8/quant_dtype_cast_int8.h" using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/activation.cc b/mindspore/lite/src/runtime/kernel/arm/int8/activation_int8.cc similarity index 100% rename from mindspore/lite/src/runtime/kernel/arm/int8/activation.cc rename to mindspore/lite/src/runtime/kernel/arm/int8/activation_int8.cc diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.h b/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.h index a9a1c84834..15990b904f 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.h +++ b/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.h @@ -22,8 +22,8 @@ #include "src/kernel_registry.h" #include "include/errorcode.h" #include "nnacl/matmul_parameter.h" -#include "nnacl/int8/deconv.h" -#include "nnacl/int8/common_func.h" +#include "nnacl/int8/deconv_int8.h" +#include "nnacl/int8/common_func_int8.h" #include "nnacl/int8/matmul_int8.h" #include "src/runtime/kernel/arm/base/layout_transform.h" #include "src/runtime/kernel/arm/base/convolution_base.h" diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc index 8d180111a2..3c8eea1735 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc @@ -18,7 +18,7 @@ #include "schema/model_generated.h" #include "src/kernel_registry.h" #include "include/errorcode.h" -#include "nnacl/int8/quant_dtype_cast.h" +#include "nnacl/int8/quant_dtype_cast_int8.h" using mindspore::lite::KernelRegistrar; using mindspore::lite::RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/fullconnection_int8.h b/mindspore/lite/src/runtime/kernel/arm/int8/fullconnection_int8.h index 03279d3082..ad0cb8d484 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/fullconnection_int8.h +++ b/mindspore/lite/src/runtime/kernel/arm/int8/fullconnection_int8.h @@ -21,7 +21,7 @@ #include "src/runtime/kernel/arm/base/fullconnection_base.h" #include "include/context.h" #include "nnacl/quantization/quantize.h" -#include "nnacl/int8/common_func.h" +#include "nnacl/int8/common_func_int8.h" using mindspore::lite::InnerContext; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc index 3a61bf9e2c..5efae074f4 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc @@ -18,7 +18,7 @@ #include #include "include/errorcode.h" #include "nnacl/errorcode.h" -#include "nnacl/int8/pad.h" +#include "nnacl/int8/pad_int8.h" #include "src/runtime/runtime_api.h" #include "src/kernel_registry.h" diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.h b/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.h index 24c417e86d..5508be0916 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.h +++ b/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.h @@ -21,7 +21,7 @@ #include "src/lite_kernel.h" #include "src/runtime/runtime_api.h" #include "nnacl/pad_parameter.h" -#include "nnacl/int8/pad.h" +#include "nnacl/int8/pad_int8.h" namespace mindspore::kernel { class PadInt8CPUKernel : public LiteKernel { diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc index f0ab251a58..b8710e2f73 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc @@ -17,7 +17,7 @@ #include "src/runtime/kernel/arm/int8/resize_int8.h" #include #include "include/errorcode.h" -#include "nnacl/int8/resize.h" +#include "nnacl/int8/resize_int8.h" #include "schema/model_generated.h" #include "src/kernel_registry.h" #include "src/runtime/runtime_api.h" diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/deconv_int8_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/deconv_int8_tests.cc index 306b32d498..0af4c1fa6f 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/deconv_int8_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/deconv_int8_tests.cc @@ -22,7 +22,7 @@ #include "mindspore/lite/src/kernel_registry.h" #include "mindspore/lite/nnacl/pack.h" #include "mindspore/lite/nnacl/fp32/matmul.h" -#include "mindspore/lite/nnacl/int8/deconv.h" +#include "mindspore/lite/nnacl/int8/deconv_int8.h" #include "mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.h" using mindspore::lite::DeviceType; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/quant_dtype_cast_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/quant_dtype_cast_tests.cc index ba66766127..e450424b32 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/quant_dtype_cast_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/quant_dtype_cast_tests.cc @@ -19,7 +19,7 @@ #include "src/common/log_adapter.h" #include "common/common_test.h" #include "mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.h" -#include "mindspore/lite/nnacl/int8/quant_dtype_cast.h" +#include "mindspore/lite/nnacl/int8/quant_dtype_cast_int8.h" #include "mindspore/lite/src/kernel_registry.h" #include "mindspore/lite/src/lite_kernel.h" diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/resize_bilinear_int8_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/resize_bilinear_int8_tests.cc index a2c7bd2deb..0484de6861 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/resize_bilinear_int8_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/resize_bilinear_int8_tests.cc @@ -20,7 +20,7 @@ #include "src/tensor.h" #include "common/common_test.h" #include "src/kernel_registry.h" -#include "nnacl/int8/resize.h" +#include "nnacl/int8/resize_int8.h" namespace mindspore { using mindspore::lite::QuantArg; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/resize_nearest_neighbor_int8_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/resize_nearest_neighbor_int8_tests.cc index a14d6dc3ab..a38b80fb8e 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/resize_nearest_neighbor_int8_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/resize_nearest_neighbor_int8_tests.cc @@ -20,7 +20,7 @@ #include "src/tensor.h" #include "common/common_test.h" #include "src/kernel_registry.h" -#include "nnacl/int8/resize.h" +#include "nnacl/int8/resize_int8.h" namespace mindspore { using mindspore::lite::QuantArg;