diff --git a/mindspore/lite/nnacl/fp32/deconv_winograd.c b/mindspore/lite/nnacl/fp32/deconv_winograd.c index 08d6616bc3..3ad7cc2c16 100644 --- a/mindspore/lite/nnacl/fp32/deconv_winograd.c +++ b/mindspore/lite/nnacl/fp32/deconv_winograd.c @@ -227,17 +227,17 @@ void DeConvWgMerge(const float *src, float *dst, size_t src_stride, size_t dst_s size_t src_step = src_stride * sizeof(float); size_t dst_step = dst_stride * sizeof(float); asm volatile( - "mov r7, %[src_ptr]\n" + "mov r11, %[src_ptr]\n" "mov r8, %[dst_ptr]\n" "mov r10, r8\n" - "vld1.32 {q0}, [r7], %[src_step]\n" + "vld1.32 {q0}, [r11], %[src_step]\n" "vld1.32 {q1}, [r8], %[dst_step]\n" - "vld1.32 {q2}, [r7], %[src_step]\n" + "vld1.32 {q2}, [r11], %[src_step]\n" "vld1.32 {q3}, [r8], %[dst_step]\n" "vadd.f32 q0, q0, q1\n" - "vld1.32 {q8}, [r7], %[src_step]\n" + "vld1.32 {q8}, [r11], %[src_step]\n" "vadd.f32 q2, q2, q3\n" "vst1.32 {q0}, [r10], %[dst_step]\n" @@ -245,19 +245,19 @@ void DeConvWgMerge(const float *src, float *dst, size_t src_stride, size_t dst_s "vld1.32 {q9}, [r8], %[dst_step]\n" - "vld1.32 {q10}, [r7], %[src_step]\n" + "vld1.32 {q10}, [r11], %[src_step]\n" "vadd.f32 q8, q8, q9\n" "vld1.32 {q11}, [r8], %[dst_step]\n" "vadd.f32 q10, q10, q11\n" - "vld1.32 {q0}, [r7], %[src_step]\n" + "vld1.32 {q0}, [r11], %[src_step]\n" "vst1.32 {q8}, [r10], %[dst_step]\n" "vst1.32 {q10}, [r10], %[dst_step]\n" "vld1.32 {q1}, [r8], %[dst_step]\n" - "vld1.32 {q2}, [r7], %[src_step]\n" + "vld1.32 {q2}, [r11], %[src_step]\n" "vld1.32 {q3}, [r8], %[dst_step]\n" "vadd.f32 q0, q0, q1\n" @@ -266,10 +266,10 @@ void DeConvWgMerge(const float *src, float *dst, size_t src_stride, size_t dst_s "vst1.32 {q0}, [r10], %[dst_step]\n" "vst1.32 {q2}, [r10], %[dst_step]\n" - "vld1.32 {q8}, [r7], %[src_step]\n" + "vld1.32 {q8}, [r11], %[src_step]\n" "vld1.32 {q9}, [r8], %[dst_step]\n" - "vld1.32 {q10}, [r7], %[src_step]\n" + "vld1.32 {q10}, [r11], %[src_step]\n" "vld1.32 {q11}, [r8], %[dst_step]\n" "vadd.f32 q8, q8, q9\n" @@ -280,7 +280,7 @@ void DeConvWgMerge(const float *src, float *dst, size_t src_stride, size_t dst_s : : [ src_ptr ] "r"(src_ptr), [ dst_ptr ] "r"(dst_ptr), [ src_step ] "r"(src_step), [ dst_step ] "r"(dst_step) - : "r7", "r8", "r10", "q0", "q1", "q2", "q3", "q8", "q9", "q10", "q11"); + : "r8", "r10", "r11", "q0", "q1", "q2", "q3", "q8", "q9", "q10", "q11"); #else for (int j = 0; j < 8; j++) { const float *s = src_ptr + j * src_stride; diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/softmax.h b/mindspore/lite/src/runtime/kernel/opencl/kernel/softmax.h index 516330003a..988c835571 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/softmax.h +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/softmax.h @@ -28,7 +28,9 @@ class SoftmaxOpenCLKernel : public OpenCLKernel { public: SoftmaxOpenCLKernel(OpParameter *parameter, const std::vector &inputs, const std::vector &outputs) - : OpenCLKernel(parameter, inputs, outputs), parameter_(reinterpret_cast(parameter)) {} + : OpenCLKernel(parameter, inputs, outputs) { + parameter_ = reinterpret_cast(parameter); + } ~SoftmaxOpenCLKernel() override = default; int Init() override; diff --git a/mindspore/lite/test/CMakeLists.txt b/mindspore/lite/test/CMakeLists.txt index f424bea6d6..4ca6fdea50 100644 --- a/mindspore/lite/test/CMakeLists.txt +++ b/mindspore/lite/test/CMakeLists.txt @@ -6,8 +6,6 @@ include_directories(${TOP_DIR}) include_directories(${TEST_DIR}) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/dependency_gtest.cmake) -string(REPLACE " -Werror " " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -string(REPLACE " -Werror " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") STRING(REPLACE " -fvisibility=hidden " " -fvisibility=default " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") STRING(REPLACE " -fvisibility=hidden " " -fvisibility=default " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") diff --git a/mindspore/lite/test/common/common_test.h b/mindspore/lite/test/common/common_test.h index c8bde4d69d..80371a4229 100644 --- a/mindspore/lite/test/common/common_test.h +++ b/mindspore/lite/test/common/common_test.h @@ -50,7 +50,7 @@ class CommonTest : public testing::Test { template static void CompareOutputData(T *output_data, T *correct_data, int size, float err_bound) { - for (size_t i = 0; i < size; i++) { + for (int i = 0; i < size; i++) { T abs = fabs(output_data[i] - correct_data[i]); ASSERT_LE(abs, err_bound); } diff --git a/mindspore/lite/test/ut/internal/CMakeLists.txt b/mindspore/lite/test/ut/internal/CMakeLists.txt index fdee819c54..65d2568004 100644 --- a/mindspore/lite/test/ut/internal/CMakeLists.txt +++ b/mindspore/lite/test/ut/internal/CMakeLists.txt @@ -6,8 +6,6 @@ include_directories(${TOP_DIR}) include_directories(${TEST_DIR}) add_compile_definitions(ENABLE_NNACL_INFER_SHAPE) -string(REPLACE " -Werror " " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -string(REPLACE " -Werror " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") STRING(REPLACE " -fvisibility=hidden " " -fvisibility=default " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") STRING(REPLACE " -fvisibility=hidden " " -fvisibility=default " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") diff --git a/mindspore/lite/test/ut/src/infer_test.cc b/mindspore/lite/test/ut/src/infer_test.cc index e48a4c2664..d777d61447 100644 --- a/mindspore/lite/test/ut/src/infer_test.cc +++ b/mindspore/lite/test/ut/src/infer_test.cc @@ -149,7 +149,7 @@ TEST_F(InferTest, TestConvNode) { ASSERT_NE(nullptr, output_data); //=================================================== ASSERT_EQ(output_size, outTensor->Size()); - for (size_t i = 0; i < outTensor->ElementsNum(); i++) { + for (int i = 0; i < outTensor->ElementsNum(); i++) { ASSERT_LE((output_data[i] - outData[i]), 0.001); } MS_LOG(INFO) << "Passed"; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/common/pack_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/common/pack_tests.cc index 79839c3c80..613e0e7c86 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/common/pack_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/common/pack_tests.cc @@ -184,7 +184,7 @@ TEST_F(TestPack, PackWeightUint8) { std::string weight_path = "./test_data/conv/convuint8_weight_32_3_3_3.bin"; auto weight_data = reinterpret_cast(mindspore::lite::ReadFile(weight_path.c_str(), &weight_size)); auto int8_weight = reinterpret_cast(malloc(weight_size)); - for (int i = 0; i < weight_size; i++) { + for (unsigned int i = 0; i < weight_size; i++) { int8_weight[i] = (int8_t)(weight_data[i] - 128); } int32_t filter_zp = 20; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc index 62201f021b..e938311b08 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/common/strided_slice_tests.cc @@ -117,7 +117,7 @@ TEST_F(TestStridedSlice, StridedSliceInt8) { EXPECT_EQ(0, ret); int8_t expect[4] = {-6, -5, 7, 8}; - for (int i = 0; i < sizeof(expect); ++i) { + for (unsigned int i = 0; i < sizeof(expect); ++i) { EXPECT_EQ(output_data[i], expect[i]); } diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/constant_of_shape_fp32_test.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/constant_of_shape_fp32_test.cc index 532cb9b71e..4f872d89ce 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/constant_of_shape_fp32_test.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/constant_of_shape_fp32_test.cc @@ -33,7 +33,7 @@ int ConstantOfShapeTestInit(std::vector *inputs_, std::vector
  • push_back(in_t); std::vector c_shape(in_t->ElementsNum()); - for (int i = 0; i < c_shape.size(); ++i) { + for (unsigned int i = 0; i < c_shape.size(); ++i) { c_shape[i] = a_ptr[i]; } auto out_t = new lite::Tensor(kNumberTypeFloat, c_shape, schema::Format_NHWC, lite::Tensor::Category::CONST_TENSOR); diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32_tests.cc index 58f4674af4..f2091a6c8c 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32_tests.cc @@ -138,10 +138,10 @@ TEST_F(TestConvolutionDwFp32, ConvDwFp32Accuracy) { CompareOutputData(output_ptr, correct_data, outputs[0]->ElementsNum(), 0.0001); delete conv_param; - for (int i = 0; i < inputs.size(); i++) { + for (unsigned int i = 0; i < inputs.size(); i++) { delete inputs[i]; } - for (int i = 0; i < outputs.size(); i++) { + for (unsigned int i = 0; i < outputs.size(); i++) { delete outputs[i]; } delete kernel; @@ -189,10 +189,10 @@ TEST_F(TestConvolutionDwFp32, ConvDwFp32Performance) { printf("Convolution_depthwise fp32 average time : %f ms\n", time_avg / 1000.0f); delete conv_param; - for (int i = 0; i < inputs.size(); i++) { + for (unsigned int i = 0; i < inputs.size(); i++) { delete inputs[i]; } - for (int i = 0; i < outputs.size(); i++) { + for (unsigned int i = 0; i < outputs.size(); i++) { delete outputs[i]; } delete kernel; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/elu_fp32_test.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/elu_fp32_test.cc index f246a3f008..8e527fd3e5 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/elu_fp32_test.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/elu_fp32_test.cc @@ -60,7 +60,7 @@ TEST_F(TestEluFp32, EluTest) { elu->Run(); std::cout << "output shape:" << std::endl; - for (int i = 0; i < outputs_.front()->shape().size(); ++i) { + for (unsigned int i = 0; i < outputs_.front()->shape().size(); ++i) { std::cout << outputs_.front()->shape()[i] << ' '; } std::cout << std::endl; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/embedding_lookup_fp32_test.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/embedding_lookup_fp32_test.cc index 367c502140..bb94ec8dfe 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/embedding_lookup_fp32_test.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/embedding_lookup_fp32_test.cc @@ -75,7 +75,7 @@ TEST_F(TestEmbeddingLookupFp32, ElTest) { el->Run(); std::cout << "output shape:" << std::endl; - for (int i = 0; i < outputs_.front()->shape().size(); ++i) { + for (unsigned int i = 0; i < outputs_.front()->shape().size(); ++i) { std::cout << outputs_.front()->shape()[i] << ' '; } std::cout << std::endl; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc index 818c7a4c7f..c7b40204b0 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/fullconnection_fp32_tests.cc @@ -146,8 +146,8 @@ TEST_F(TestFcFp32, FcTest2) { CompareOutputData(reinterpret_cast(outputs_[0]->MutableData()), correct, total_size, 0.0001); } -int FcTestInit3(std::vector *inputs_, std::vector *outputs_, - MatMulParameter *matmal_param, float **correct) { +void FcTestInit3(std::vector *inputs_, std::vector *outputs_, + MatMulParameter *matmal_param, float **correct) { Tensor *in_t = new Tensor(kNumberTypeFloat, {1, 1, 1, 20}, schema::Format_NHWC, lite::Tensor::Category::CONST_TENSOR); in_t->MallocData(); float in[] = {1, 0, 3, 0, 4, 5, 2, 5, 2, 5, 1, 5, 0, 1, 2, 0, 2, 1, 0, 5}; @@ -177,7 +177,6 @@ int FcTestInit3(std::vector *inputs_, std::vectora_transpose_ = false; matmal_param->has_bias_ = false; matmal_param->act_type_ = ActType_No; - return out_t->ElementsNum(); } TEST_F(TestFcFp32, FcTest3) { @@ -185,7 +184,7 @@ TEST_F(TestFcFp32, FcTest3) { std::vector outputs_; auto matmul_param = new MatMulParameter(); float *correct; - int total_size = FcTestInit3(&inputs_, &outputs_, matmul_param, &correct); + FcTestInit3(&inputs_, &outputs_, matmul_param, &correct); lite::InnerContext *ctx = new lite::InnerContext; ctx->thread_num_ = 1; ASSERT_EQ(lite::RET_OK, ctx->Init()); diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/lstm_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/lstm_fp32_tests.cc index 6d61e4c919..cea7665582 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/lstm_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/lstm_fp32_tests.cc @@ -171,10 +171,10 @@ TEST_F(LstmFp32, LstmForwardFp32Accuracy) { CompareOutput(outputs[2], output2_data); delete lstm_param; - for (int i = 0; i < inputs.size() - 1; i++) { + for (unsigned int i = 0; i < inputs.size() - 1; i++) { delete inputs[i]; } - for (int i = 0; i < outputs.size(); i++) { + for (unsigned int i = 0; i < outputs.size(); i++) { delete outputs[i]; } delete kernel; @@ -321,10 +321,10 @@ TEST_F(LstmFp32, LstmBackwardFp32Accuracy) { CompareOutput(outputs[2], output2_data); delete lstm_param; - for (int i = 0; i < inputs.size() - 1; i++) { + for (unsigned int i = 0; i < inputs.size() - 1; i++) { delete inputs[i]; } - for (int i = 0; i < outputs.size(); i++) { + for (unsigned int i = 0; i < outputs.size(); i++) { delete outputs[i]; } delete kernel; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/power_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/power_fp32_tests.cc index 2630b2c99b..c677a1c4ad 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/power_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/power_fp32_tests.cc @@ -79,7 +79,6 @@ TEST_F(TestPowerFp32, Simple) { op->Init(); op->Run(); float correct[] = {1, 64, 2187, 65536}; - float *output = reinterpret_cast(outputs_[0]->MutableData()); CompareOutputData(reinterpret_cast(outputs_[0]->MutableData()), correct, total_size, 0.0001); delete op; for (auto t : inputs_) delete t; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc index 83118945b8..665718e84a 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/skip_gram_fp32.cc @@ -67,7 +67,7 @@ TEST_F(TestSkipGramFp32, ElTest) { el->Run(); std::vector output = mindspore::lite::ParseTensorBuffer(outputs_[0]); - for (int i = 0; i < output.size(); i++) { + for (unsigned int i = 0; i < output.size(); i++) { for (int j = 0; j < output[i].len; j++) { printf("%c", output[i].data[j]); } diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc index 67668d0126..5f9bca0975 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc @@ -39,7 +39,7 @@ TEST_F(SpaceToBatchTestFp32, SpaceToBatchTest4) { param.block_sizes_[0] = 2; param.block_sizes_[1] = 1; DoSpaceToBatchNHWC(input.data(), out, param.block_sizes_, in_shape.data(), out_shape.data()); - for (int i = 0; i < kOutSize; ++i) { + for (unsigned int i = 0; i < kOutSize; ++i) { std::cout << out[i] << " "; } std::cout << "\n"; @@ -57,7 +57,7 @@ TEST_F(SpaceToBatchTestFp32, SpaceToBatchTest5) { param.block_sizes_[0] = 1; param.block_sizes_[1] = 2; DoSpaceToBatchNHWC(input.data(), out, param.block_sizes_, in_shape.data(), out_shape.data()); - for (int i = 0; i < kOutSize; ++i) { + for (unsigned int i = 0; i < kOutSize; ++i) { std::cout << out[i] << " "; } std::cout << "\n"; @@ -75,7 +75,7 @@ TEST_F(SpaceToBatchTestFp32, SpaceToBatchTest6) { param.block_sizes_[0] = 2; param.block_sizes_[1] = 2; DoSpaceToBatchNHWC(input.data(), out, param.block_sizes_, in_shape.data(), out_shape.data()); - for (int i = 0; i < kOutSize; ++i) { + for (unsigned int i = 0; i < kOutSize; ++i) { std::cout << out[i] << " "; } std::cout << "\n"; @@ -97,7 +97,7 @@ TEST_F(SpaceToBatchTestFp32, SpaceToBatchTest7) { param.block_sizes_[0] = 2; param.block_sizes_[1] = 2; DoSpaceToBatchNHWC(input.data(), out, param.block_sizes_, in_shape.data(), out_shape.data()); - for (int i = 0; i < kOutSize; ++i) { + for (unsigned int i = 0; i < kOutSize; ++i) { std::cout << out[i] << " "; } std::cout << "\n"; @@ -116,7 +116,7 @@ TEST_F(SpaceToBatchTestFp32, SpaceToBatchTest8) { std::vector out_shape = {1, 5, 5, 2}; std::vector padding = {0, 1, 0, 1}; DoSpaceToBatchPaddingNHWC(input.data(), out, in_shape.data(), padding.data(), out_shape.data()); - for (int i = 0; i < kOutSize; ++i) { + for (unsigned int i = 0; i < kOutSize; ++i) { std::cout << out[i] << " "; } std::cout << "\n"; @@ -136,7 +136,7 @@ TEST_F(SpaceToBatchTestFp32, SpaceToBatchTest9) { std::vector out_shape = {1, 6, 6, 2}; std::vector padding = {1, 1, 1, 1}; DoSpaceToBatchPaddingNHWC(input.data(), out, in_shape.data(), padding.data(), out_shape.data()); - for (int i = 0; i < kOutSize; ++i) { + for (unsigned int i = 0; i < kOutSize; ++i) { std::cout << out[i] << " "; } std::cout << "\n"; @@ -162,7 +162,7 @@ TEST_F(SpaceToBatchTestFp32, SpaceToBatchTest10) { param.block_sizes_[0] = 2; param.block_sizes_[1] = 2; DoSpaceToBatchNHWC(pedding_out, out, param.block_sizes_, pedding_out_shape.data(), out_shape.data()); - for (int i = 0; i < kOutSize; ++i) { + for (unsigned int i = 0; i < kOutSize; ++i) { std::cout << out[i] << " "; } std::cout << "\n"; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32_grad/pooling_grad_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32_grad/pooling_grad_fp32_tests.cc index 355f54669d..7ba5b2e4ba 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32_grad/pooling_grad_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32_grad/pooling_grad_fp32_tests.cc @@ -276,10 +276,7 @@ TEST_F(TestPoolingGradFp32, AvgPoolGradStride2Fp32) { kernel->Init(); - auto time_start = mindspore::lite::GetTimeUs(); kernel->Run(); - auto time_end = mindspore::lite::GetTimeUs(); - printf("single thread running time : %lu ms\n", time_end - time_start); std::string output_path = "./test_data/pooling/avgpoolgradfp32_s2_dx_3_28_28_3.bin"; auto res = lite::CompareRelativeOutput(out_data, output_path); @@ -340,10 +337,7 @@ TEST_F(TestPoolingGradFp32, AvgPoolGradStride3Fp32) { kernel->Init(); - auto time_start = mindspore::lite::GetTimeUs(); kernel->Run(); - auto time_end = mindspore::lite::GetTimeUs(); - printf("single thread running time : %lu ms\n", time_end - time_start); std::string output_path = "./test_data/pooling/avgpoolgradfp32_s3_dx_3_28_28_3.bin"; auto res = lite::CompareRelativeOutput(out_data, output_path); @@ -461,10 +455,7 @@ TEST_F(TestPoolingGradFp32, MaxPoolGradBatchFp32) { kernel->Init(); - auto time_start = mindspore::lite::GetTimeUs(); kernel->Run(); - auto time_end = mindspore::lite::GetTimeUs(); - printf("single thread running time : %lu ms\n", time_end - time_start); std::string output_path = "./test_data/pooling/maxpoolgradfp32_1_xgrad_3_28_28_3.bin"; auto res = lite::CompareRelativeOutput(out_data, output_path); @@ -535,10 +526,7 @@ TEST_F(TestPoolingGradFp32, MaxPoolGradStride2Fp32) { kernel->Init(); - auto time_start = mindspore::lite::GetTimeUs(); kernel->Run(); - auto time_end = mindspore::lite::GetTimeUs(); - printf("single thread running time : %lu ms\n", time_end - time_start); std::string output_path = "./test_data/pooling/maxpoolgradfp32_s2_xgrad_3_28_28_3.bin"; auto res = lite::CompareRelativeOutput(out_data, output_path); @@ -609,10 +597,7 @@ TEST_F(TestPoolingGradFp32, MaxPoolGradStride3Fp32) { kernel->Init(); - auto time_start = mindspore::lite::GetTimeUs(); kernel->Run(); - auto time_end = mindspore::lite::GetTimeUs(); - printf("single thread running time : %lu ms\n", time_end - time_start); std::string output_path = "./test_data/pooling/maxpoolgradfp32_s3_xgrad_3_28_28_3.bin"; auto res = lite::CompareRelativeOutput(out_data, output_path); diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/relux_int8_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/relux_int8_tests.cc index 159990deb5..98e0188aaa 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/relux_int8_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/int8/relux_int8_tests.cc @@ -108,7 +108,7 @@ TEST_F(TestReluXInt8, Relu6) { // 0.0f, 0.0f, 1.25f, 3.0f, 4.5f, 6.0f, 6.0f, 6.0f int8_t expect[8] = {-128, -128, -96, -52, -14, 25, 25, 25}; - for (int i = 0; i < sizeof(expect); ++i) { + for (unsigned int i = 0; i < sizeof(expect); ++i) { EXPECT_EQ(output_data[i], expect[i]); } diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/string/normalize.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/string/normalize.cc index e236839c0a..ebfe33f62c 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/string/normalize.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/string/normalize.cc @@ -68,12 +68,12 @@ TEST_F(TestNormalize, TestSentence) { kernel_ = creator_(inputs_, outputs_, ¶meter_, &ctx_, desc_, nullptr); ASSERT_NE(kernel_, nullptr); auto ret = kernel_->Init(); - MS_ASSERT(ret == 0); + ASSERT_EQ(ret, 0); ret = kernel_->Run(); - MS_ASSERT(ret == 0); + ASSERT_EQ(ret, 0); std::vector output = mindspore::lite::ParseTensorBuffer(outputs_[0]); - for (int i = 0; i < output.size(); i++) { + for (unsigned int i = 0; i < output.size(); i++) { for (int j = 0; j < output[i].len; j++) { printf("%c", output[i].data[j]); } diff --git a/mindspore/lite/test/ut/src/runtime/kernel/opencl/activation_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/opencl/activation_tests.cc index dd341616b5..f73c73967d 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/opencl/activation_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/opencl/activation_tests.cc @@ -91,7 +91,6 @@ TEST_F(TestActivationOpenCL, ReluFp_dim4) { MS_LOG(INFO) << "Init tensors."; std::vector input_shape = {1, 9}; schema::Format format = schema::Format_NC; - schema::Format op_format = schema::Format_NC4; auto tensor_type = lite::Tensor::CONST_TENSOR; auto *input_tensor = new (std::nothrow) lite::Tensor(data_type, input_shape, format, tensor_type); if (input_tensor == nullptr) { @@ -198,7 +197,6 @@ TEST_F(TestActivationOpenCL, Relu6Fp_dim4) { MS_LOG(INFO) << "Init tensors."; std::vector input_shape = {1, 9}; schema::Format format = schema::Format_NC; - schema::Format op_format = schema::Format_NC4; auto tensor_type = lite::Tensor::CONST_TENSOR; auto *input_tensor = new (std::nothrow) lite::Tensor(data_type, input_shape, format, tensor_type); if (input_tensor == nullptr) { @@ -308,7 +306,6 @@ TEST_F(TestActivationOpenCL, SigmoidFp_dim4) { MS_LOG(INFO) << "Init tensors."; std::vector input_shape = {1, 9}; schema::Format format = schema::Format_NC; - schema::Format op_format = schema::Format_NC4; auto tensor_type = lite::Tensor::CONST_TENSOR; auto *input_tensor = new (std::nothrow) lite::Tensor(data_type, input_shape, format, tensor_type); if (input_tensor == nullptr) { @@ -411,15 +408,14 @@ TEST_F(TestActivationOpenCL, LeakyReluFp_dim4) { MS_LOG(INFO) << "Leaky relu Begin test!"; auto ocl_runtime = lite::opencl::OpenCLRuntimeWrapper().GetInstance(); ocl_runtime->Init(); - auto data_type = kNumberTypeFloat16; // need modify + auto data_type = kNumberTypeFloat16; ocl_runtime->SetFp16Enable(data_type == kNumberTypeFloat16); bool enable_fp16 = ocl_runtime->GetFp16Enable(); MS_LOG(INFO) << "Init tensors."; - std::vector input_shape = {1, 9}; // need modify + std::vector input_shape = {1, 9}; auto tensor_type = lite::Tensor::CONST_TENSOR; - schema::Format format = schema::Format_NC; // need modify - schema::Format op_format = schema::Format_NHWC4; // need modify + schema::Format format = schema::Format_NC; auto *input_tensor = new (std::nothrow) lite::Tensor(data_type, input_shape, format, tensor_type); if (input_tensor == nullptr) { MS_LOG(ERROR) << "new input tensor error!"; @@ -527,7 +523,6 @@ TEST_F(TestActivationOpenCLTanh, TanhFp_dim4) { MS_LOG(INFO) << "Init tensors."; std::vector input_shape = {1, 2, 3, 9}; schema::Format format = schema::Format_NHWC; - schema::Format op_format = schema::Format_NC4HW4; auto tensor_type = lite::Tensor::CONST_TENSOR; auto *input_tensor = new (std::nothrow) lite::Tensor(data_type, input_shape, format, tensor_type); if (input_tensor == nullptr) { diff --git a/mindspore/lite/test/ut/src/runtime/kernel/opencl/biasadd_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/opencl/biasadd_tests.cc index d93655cb18..932e0660c1 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/opencl/biasadd_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/opencl/biasadd_tests.cc @@ -77,13 +77,12 @@ TEST_F(TestBiasAddOpenCL, BiasAddFp32_dim4) { MS_LOG(INFO) << "BiasAdd Begin test:"; auto ocl_runtime = lite::opencl::OpenCLRuntimeWrapper().GetInstance(); ocl_runtime->Init(); - auto data_type = kNumberTypeFloat16; // need modify + auto data_type = kNumberTypeFloat16; ocl_runtime->SetFp16Enable(data_type == kNumberTypeFloat16); - std::vector input_shape = {1, 9}; // need modify - std::vector output_shape = {1, 9}; // need modify + std::vector input_shape = {1, 9}; + std::vector output_shape = {1, 9}; auto tensor_type = lite::Tensor::CONST_TENSOR; - schema::Format type = schema::Format_NC; // need modify - schema::Format op_format = schema::Format_NC4; // need modify + schema::Format type = schema::Format_NC; int weight_shape = 0; if (input_shape.size() == 4) { weight_shape = input_shape[3]; diff --git a/mindspore/lite/test/ut/src/runtime/kernel/opencl/prelu_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/opencl/prelu_tests.cc index 47e72f465e..9977a5e4ef 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/opencl/prelu_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/opencl/prelu_tests.cc @@ -86,7 +86,6 @@ TEST_F(TestPReluOpenCL, PReluFp32_dim4) { auto data_type = kNumberTypeFloat16; ocl_runtime->SetFp16Enable(data_type == kNumberTypeFloat16); schema::Format format = schema::Format_NHWC; - schema::Format op_format = schema::Format_NC4HW4; auto tensor_type = lite::Tensor::CONST_TENSOR; auto input_tensor = new (std::nothrow) lite::Tensor(data_type, input_shape, format, tensor_type); if (input_tensor == nullptr) {