From d527304ad0b4479eec5f5d1cb3a9fbfaa6320fa2 Mon Sep 17 00:00:00 2001 From: wang-yangsong Date: Fri, 31 May 2024 15:43:39 +0800 Subject: [PATCH 1/3] fix bug Signed-off-by: wang-yangsong --- test/unittest/ops/all_test.cpp | 1 - test/unittest/ops/assert_test.cpp | 1 - test/unittest/ops/avgpool_pad_test.cpp | 6 ------ test/unittest/ops/avgpool_padmod_test.cpp | 2 -- test/unittest/ops/broadcast_to_test.cpp | 1 - test/unittest/ops/clip_test.cpp | 2 -- test/unittest/ops/constant_of_shape_test.cpp | 4 +--- test/unittest/ops/crop_test.cpp | 4 +--- test/unittest/ops/depth_to_space_test.cpp | 2 -- test/unittest/ops/detection_post_process_test.cpp | 10 ---------- test/unittest/ops/exp_test.cpp | 3 --- test/unittest/ops/flatten_test.cpp | 1 - test/unittest/ops/gelu_builder_test.cpp | 1 - test/unittest/ops/instance_norm_test.cpp | 1 - test/unittest/ops/l2_normalize_test.cpp | 3 --- test/unittest/ops/leaky_relu_test.cpp | 1 - test/unittest/ops/log_softmax_test.cpp | 1 - test/unittest/ops/lrn_test.cpp | 5 ----- test/unittest/ops/lstm_test.cpp | 13 ------------- test/unittest/ops/maxpool_pad_test.cpp | 2 -- test/unittest/ops/maxpool_padmode_test.cpp | 2 -- test/unittest/ops/pow_builder_test.cpp | 2 -- test/unittest/ops/quant_dtype_cast_builder_test.cpp | 3 --- test/unittest/ops/range_test.cpp | 3 --- test/unittest/ops/reduce_all_builder_test.cpp | 3 --- test/unittest/ops/reduce_l2_test.cpp | 3 --- test/unittest/ops/reduce_max_builder_test.cpp | 3 --- test/unittest/ops/reduce_mean_builder_test.cpp | 3 --- test/unittest/ops/reduce_min_builder_test.cpp | 3 --- test/unittest/ops/reduce_prod_builder_test.cpp | 3 --- test/unittest/ops/reduce_sum_builder_test.cpp | 3 --- test/unittest/ops/space_to_depth_test.cpp | 1 - test/unittest/ops/tile_builder_test.cpp | 1 - test/unittest/ops/unstack_test.cpp | 1 - 34 files changed, 2 insertions(+), 96 deletions(-) diff --git a/test/unittest/ops/all_test.cpp b/test/unittest/ops/all_test.cpp index 933e2e6..50df305 100644 --- a/test/unittest/ops/all_test.cpp +++ b/test/unittest/ops/all_test.cpp @@ -179,7 +179,6 @@ HWTEST_F(AllBuilderTest, all_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - keepDimsTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/assert_test.cpp b/test/unittest/ops/assert_test.cpp index 132b091..a18f073 100644 --- a/test/unittest/ops/assert_test.cpp +++ b/test/unittest/ops/assert_test.cpp @@ -179,7 +179,6 @@ HWTEST_F(AssertBuilderTest, assert_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - summarizeTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/avgpool_pad_test.cpp b/test/unittest/ops/avgpool_pad_test.cpp index ab5f74b..26886bb 100644 --- a/test/unittest/ops/avgpool_pad_test.cpp +++ b/test/unittest/ops/avgpool_pad_test.cpp @@ -225,7 +225,6 @@ HWTEST_F(AvgPoolPadBuilderTest, avgpool_build_pad_007, TestSize.Level1) SetRoundMode(OH_NN_INT32, m_param_dim, nullptr, OH_NN_AVG_POOL_ROUND_MODE); SetGlobal(OH_NN_BOOL, m_param_dim, nullptr, OH_NN_AVG_POOL_GLOBAL); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** @@ -252,7 +251,6 @@ HWTEST_F(AvgPoolPadBuilderTest, avgpool_build_pad_008, TestSize.Level1) SetRoundMode(OH_NN_INT32, m_param_dim, nullptr, OH_NN_AVG_POOL_ROUND_MODE); SetGlobal(OH_NN_BOOL, m_param_dim, nullptr, OH_NN_AVG_POOL_GLOBAL); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** @@ -279,7 +277,6 @@ HWTEST_F(AvgPoolPadBuilderTest, avgpool_build_pad_009, TestSize.Level1) SetRoundMode(OH_NN_INT32, m_param_dim, nullptr, OH_NN_AVG_POOL_ROUND_MODE); SetGlobal(OH_NN_BOOL, m_param_dim, nullptr, OH_NN_AVG_POOL_GLOBAL); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** @@ -306,7 +303,6 @@ HWTEST_F(AvgPoolPadBuilderTest, avgpool_build_pad_010, TestSize.Level1) SetRoundMode(OH_NN_INT32, m_param_dim, nullptr, OH_NN_AVG_POOL_ROUND_MODE); SetGlobal(OH_NN_BOOL, m_param_dim, nullptr, OH_NN_AVG_POOL_GLOBAL); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** @@ -333,7 +329,6 @@ HWTEST_F(AvgPoolPadBuilderTest, avgpool_build_pad_011, TestSize.Level1) m_allTensors.emplace_back(tensor); SetGlobal(OH_NN_BOOL, m_param_dim, nullptr, OH_NN_AVG_POOL_GLOBAL); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** @@ -360,7 +355,6 @@ HWTEST_F(AvgPoolPadBuilderTest, avgpool_build_pad_012, TestSize.Level1) tensor->SetBuffer(globalValue, sizeof(int32_t)); m_allTensors.emplace_back(tensor); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/avgpool_padmod_test.cpp b/test/unittest/ops/avgpool_padmod_test.cpp index c16d2de..6c0ab7f 100644 --- a/test/unittest/ops/avgpool_padmod_test.cpp +++ b/test/unittest/ops/avgpool_padmod_test.cpp @@ -331,7 +331,6 @@ HWTEST_F(AvgPoolBuilderTest, avgpool_build_pad_mode_011, TestSize.Level1) m_allTensors.emplace_back(tensor); SetGlobal(OH_NN_BOOL, m_param_dim, nullptr, OH_NN_AVG_POOL_GLOBAL); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** @@ -358,7 +357,6 @@ HWTEST_F(AvgPoolBuilderTest, avgpool_build_pad_mode_012, TestSize.Level1) tensor->SetBuffer(globalValue, sizeof(int32_t)); m_allTensors.emplace_back(tensor); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/broadcast_to_test.cpp b/test/unittest/ops/broadcast_to_test.cpp index cb7cbdc..bba5dd8 100644 --- a/test/unittest/ops/broadcast_to_test.cpp +++ b/test/unittest/ops/broadcast_to_test.cpp @@ -169,7 +169,6 @@ HWTEST_F(BroadcastToBuilderTest, broadcast_to_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - shapeTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/clip_test.cpp b/test/unittest/ops/clip_test.cpp index e26d4bb..254c046 100644 --- a/test/unittest/ops/clip_test.cpp +++ b/test/unittest/ops/clip_test.cpp @@ -184,7 +184,6 @@ HWTEST_F(ClipBuilderTest, clip_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - maxTensor->SetBuffer(nullptr, 0); } /** @@ -207,7 +206,6 @@ HWTEST_F(ClipBuilderTest, clip_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - minTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/constant_of_shape_test.cpp b/test/unittest/ops/constant_of_shape_test.cpp index e52e1c7..7efbac6 100644 --- a/test/unittest/ops/constant_of_shape_test.cpp +++ b/test/unittest/ops/constant_of_shape_test.cpp @@ -179,13 +179,12 @@ HWTEST_F(ConstantOfShapeBuilderTest, constant_of_shape_build_007, TestSize.Level std::shared_ptr dataTypeTensor = TransToNNTensor(OH_NN_FLOAT32, m_dataTypeDim, nullptr, OH_NN_CONSTANT_OF_SHAPE_DATA_TYPE); float* dataTypeValue = new (std::nothrow) float [1]{0.0f}; - dataTypeTensor->SetBuffer(&dataTypeValue, sizeof(float)); + dataTypeTensor->SetBuffer(dataTypeValue, sizeof(float)); m_allTensors.emplace_back(dataTypeTensor); SaveValue(OH_NN_FLOAT32, m_valueDim, nullptr, OH_NN_CONSTANT_OF_SHAPE_VALUE); OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - dataTypeTensor->SetBuffer(nullptr, 0); } /** @@ -209,7 +208,6 @@ HWTEST_F(ConstantOfShapeBuilderTest, constant_of_shape_build_008, TestSize.Level OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - valueTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/crop_test.cpp b/test/unittest/ops/crop_test.cpp index 370e9f9..77972d7 100644 --- a/test/unittest/ops/crop_test.cpp +++ b/test/unittest/ops/crop_test.cpp @@ -194,13 +194,12 @@ HWTEST_F(CropBuilderTest, crop_build_007, TestSize.Level1) std::shared_ptr axisTensor = TransToNNTensor(OH_NN_FLOAT32, m_axisDim, nullptr, OH_NN_CROP_AXIS); float* axisValue = new (std::nothrow) float [1]{0.0f}; - axisTensor->SetBuffer(&axisValue, sizeof(float)); + axisTensor->SetBuffer(axisValue, sizeof(float)); m_allTensors.emplace_back(axisTensor); SaveOffset(OH_NN_INT64, m_offsetDim, nullptr, OH_NN_CROP_OFFSET); OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - axisTensor->SetBuffer(nullptr, 0); } /** @@ -224,7 +223,6 @@ HWTEST_F(CropBuilderTest, crop_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - offsetTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/depth_to_space_test.cpp b/test/unittest/ops/depth_to_space_test.cpp index c71e04e..06fb369 100644 --- a/test/unittest/ops/depth_to_space_test.cpp +++ b/test/unittest/ops/depth_to_space_test.cpp @@ -185,7 +185,6 @@ HWTEST_F(DepthToSpaceBuilderTest, depth_to_space_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - blockSizeTensor->SetBuffer(nullptr, 0); } /** @@ -208,7 +207,6 @@ HWTEST_F(DepthToSpaceBuilderTest, depth_to_space_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - modeTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/detection_post_process_test.cpp b/test/unittest/ops/detection_post_process_test.cpp index 9afc12d..da34b7a 100644 --- a/test/unittest/ops/detection_post_process_test.cpp +++ b/test/unittest/ops/detection_post_process_test.cpp @@ -342,7 +342,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_007, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - inputSizeTensor->SetBuffer(nullptr, 0); } /** @@ -373,7 +372,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_008, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - scaleTensor->SetBuffer(nullptr, 0); } /** @@ -403,7 +401,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_009, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - nmsIoUThresholdTensor->SetBuffer(nullptr, 0); } /** @@ -433,7 +430,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_010, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - nmsScoreThresholdTensor->SetBuffer(nullptr, 0); } /** @@ -463,7 +459,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_011, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - maxDetectionsTensor->SetBuffer(nullptr, 0); } /** @@ -493,7 +488,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_012, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - detectionsPerClassTensor->SetBuffer(nullptr, 0); } /** @@ -523,7 +517,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_013, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - maxClassesPerDetectionTensor->SetBuffer(nullptr, 0); } /** @@ -554,7 +547,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_014, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - numClassesTensor->SetBuffer(nullptr, 0); } /** @@ -584,7 +576,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_015, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - useRegularNmsTensor->SetBuffer(nullptr, 0); } /** @@ -614,7 +605,6 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_016, Test OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - outQuantizedTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/exp_test.cpp b/test/unittest/ops/exp_test.cpp index d5c6ead..a25fc5b 100644 --- a/test/unittest/ops/exp_test.cpp +++ b/test/unittest/ops/exp_test.cpp @@ -201,7 +201,6 @@ HWTEST_F(ExpBuilderTest, exp_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - baseTensor->SetBuffer(nullptr, 0); } /** @@ -225,7 +224,6 @@ HWTEST_F(ExpBuilderTest, exp_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - scaleTensor->SetBuffer(nullptr, 0); } /** @@ -249,7 +247,6 @@ HWTEST_F(ExpBuilderTest, exp_build_009, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - shiftTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/flatten_test.cpp b/test/unittest/ops/flatten_test.cpp index cf61344..02014c9 100644 --- a/test/unittest/ops/flatten_test.cpp +++ b/test/unittest/ops/flatten_test.cpp @@ -168,7 +168,6 @@ HWTEST_F(FlattenBuilderTest, flatten_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - axisTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/gelu_builder_test.cpp b/test/unittest/ops/gelu_builder_test.cpp index 483e1c5..869151c 100644 --- a/test/unittest/ops/gelu_builder_test.cpp +++ b/test/unittest/ops/gelu_builder_test.cpp @@ -189,7 +189,6 @@ HWTEST_F(GeluBuilderTest, gelu_build_008, TestSize.Level0) OH_NN_ReturnCode ret = m_gelu.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - approximateTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/instance_norm_test.cpp b/test/unittest/ops/instance_norm_test.cpp index 1c4aff3..7c211ad 100644 --- a/test/unittest/ops/instance_norm_test.cpp +++ b/test/unittest/ops/instance_norm_test.cpp @@ -186,7 +186,6 @@ HWTEST_F(InstanceNormBuilderTest, instance_norm_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - epsilonTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/l2_normalize_test.cpp b/test/unittest/ops/l2_normalize_test.cpp index 9b11b7c..8548381 100644 --- a/test/unittest/ops/l2_normalize_test.cpp +++ b/test/unittest/ops/l2_normalize_test.cpp @@ -189,7 +189,6 @@ HWTEST_F(L2NormalizeBuilderTest, l2_normalize_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - axisTensor->SetBuffer(nullptr, 0); } /** @@ -212,7 +211,6 @@ HWTEST_F(L2NormalizeBuilderTest, l2_normalize_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - epsilonTensor->SetBuffer(nullptr, 0); } /** @@ -235,7 +233,6 @@ HWTEST_F(L2NormalizeBuilderTest, l2_normalize_build_009, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - activationTypeTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/leaky_relu_test.cpp b/test/unittest/ops/leaky_relu_test.cpp index 6647375..8e07631 100644 --- a/test/unittest/ops/leaky_relu_test.cpp +++ b/test/unittest/ops/leaky_relu_test.cpp @@ -167,7 +167,6 @@ HWTEST_F(LeakyReluBuilderTest, leaky_relu_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - negativeSlopeTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/log_softmax_test.cpp b/test/unittest/ops/log_softmax_test.cpp index 925f0ab..1267073 100644 --- a/test/unittest/ops/log_softmax_test.cpp +++ b/test/unittest/ops/log_softmax_test.cpp @@ -166,7 +166,6 @@ HWTEST_F(LogSoftmaxBuilderTest, log_softmax_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - axisTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/lrn_test.cpp b/test/unittest/ops/lrn_test.cpp index 3b5804d..7889678 100644 --- a/test/unittest/ops/lrn_test.cpp +++ b/test/unittest/ops/lrn_test.cpp @@ -235,7 +235,6 @@ HWTEST_F(LRNBuilderTest, lrn_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - depthRadiusTensor->SetBuffer(nullptr, 0); } /** @@ -260,7 +259,6 @@ HWTEST_F(LRNBuilderTest, lrn_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - alphaTensor->SetBuffer(nullptr, 0); } /** @@ -285,7 +283,6 @@ HWTEST_F(LRNBuilderTest, lrn_build_009, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - betaTensor->SetBuffer(nullptr, 0); } /** @@ -310,7 +307,6 @@ HWTEST_F(LRNBuilderTest, lrn_build_010, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - biasTensor->SetBuffer(nullptr, 0); } /** @@ -335,7 +331,6 @@ HWTEST_F(LRNBuilderTest, lrn_build_011, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - normRegionTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/lstm_test.cpp b/test/unittest/ops/lstm_test.cpp index 295ca05..4158129 100644 --- a/test/unittest/ops/lstm_test.cpp +++ b/test/unittest/ops/lstm_test.cpp @@ -379,7 +379,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - bidirectionalTensor->SetBuffer(nullptr, 0); } /** @@ -410,7 +409,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - hasBiasTensor->SetBuffer(nullptr, 0); } /** @@ -441,7 +439,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_009, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - inputSizeTensor->SetBuffer(nullptr, 0); } /** @@ -472,7 +469,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_010, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - hiddenSizeTensor->SetBuffer(nullptr, 0); } /** @@ -503,7 +499,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_011, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - numLayersTensor->SetBuffer(nullptr, 0); } /** @@ -534,7 +529,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_012, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - numDirectionsTensor->SetBuffer(nullptr, 0); } /** @@ -565,7 +559,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_013, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - dropoutTensor->SetBuffer(nullptr, 0); } /** @@ -596,7 +589,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_014, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - zoneoutCellTensor->SetBuffer(nullptr, 0); } /** @@ -627,7 +619,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_015, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - zoneoutHiddenTensor->SetBuffer(nullptr, 0); } /** @@ -658,7 +649,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_016, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - projSizeTensor->SetBuffer(nullptr, 0); } /** @@ -1042,7 +1032,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_031, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - hiddenSizeTensor->SetBuffer(nullptr, 0); } /** @@ -1070,7 +1059,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_032, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - numLayersTensor->SetBuffer(nullptr, 0); } /** @@ -1098,7 +1086,6 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_033, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - numDirectionsTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/maxpool_pad_test.cpp b/test/unittest/ops/maxpool_pad_test.cpp index 6228084..cdcdbb6 100644 --- a/test/unittest/ops/maxpool_pad_test.cpp +++ b/test/unittest/ops/maxpool_pad_test.cpp @@ -330,7 +330,6 @@ HWTEST_F(MaxPoolPadBuilderTest, maxpool_build_pad_011, TestSize.Level1) m_allTensors.emplace_back(tensor); SetGlobal(OH_NN_BOOL, m_param_dim, nullptr, OH_NN_MAX_POOL_GLOBAL); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** @@ -357,7 +356,6 @@ HWTEST_F(MaxPoolPadBuilderTest, maxpool_build_pad_012, TestSize.Level1) tensor->SetBuffer(globalValue, sizeof(int32_t)); m_allTensors.emplace_back(tensor); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/maxpool_padmode_test.cpp b/test/unittest/ops/maxpool_padmode_test.cpp index d6c1b79..618ff6e 100644 --- a/test/unittest/ops/maxpool_padmode_test.cpp +++ b/test/unittest/ops/maxpool_padmode_test.cpp @@ -323,7 +323,6 @@ HWTEST_F(MaxPoolBuilderTest, maxpool_build_pad_mode_011, TestSize.Level1) m_allTensors.emplace_back(tensor); SetGlobal(OH_NN_BOOL, m_param_dim, nullptr, OH_NN_MAX_POOL_GLOBAL); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** @@ -350,7 +349,6 @@ HWTEST_F(MaxPoolBuilderTest, maxpool_build_pad_mode_012, TestSize.Level1) tensor->SetBuffer(globalValue, sizeof(int32_t)); m_allTensors.emplace_back(tensor); EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); - tensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/pow_builder_test.cpp b/test/unittest/ops/pow_builder_test.cpp index 5247a80..f7b7b37 100644 --- a/test/unittest/ops/pow_builder_test.cpp +++ b/test/unittest/ops/pow_builder_test.cpp @@ -184,7 +184,6 @@ HWTEST_F(PowBuilderTest, pow_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - shiftTensor->SetBuffer(nullptr, 0); } /** @@ -206,7 +205,6 @@ HWTEST_F(PowBuilderTest, pow_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - scaleTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/quant_dtype_cast_builder_test.cpp b/test/unittest/ops/quant_dtype_cast_builder_test.cpp index 9a04672..e329d23 100644 --- a/test/unittest/ops/quant_dtype_cast_builder_test.cpp +++ b/test/unittest/ops/quant_dtype_cast_builder_test.cpp @@ -321,7 +321,6 @@ HWTEST_F(QuantDTypeCastBuilderTest, quantdtypecast_build_013, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputs, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - srcTensor->SetBuffer(nullptr, 0); } /** @@ -342,7 +341,6 @@ HWTEST_F(QuantDTypeCastBuilderTest, quantdtypecast_build_014, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputs, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - dstTensor->SetBuffer(nullptr, 0); } /** @@ -363,7 +361,6 @@ HWTEST_F(QuantDTypeCastBuilderTest, quantdtypecast_build_015, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputs, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - axisTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/range_test.cpp b/test/unittest/ops/range_test.cpp index e53251d..bd26295 100644 --- a/test/unittest/ops/range_test.cpp +++ b/test/unittest/ops/range_test.cpp @@ -201,7 +201,6 @@ HWTEST_F(RangeBuilderTest, range_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - startTensor->SetBuffer(nullptr, 0); } /** @@ -225,7 +224,6 @@ HWTEST_F(RangeBuilderTest, range_build_008, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - limitTensor->SetBuffer(nullptr, 0); } /** @@ -249,7 +247,6 @@ HWTEST_F(RangeBuilderTest, range_build_009, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - deltaTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/reduce_all_builder_test.cpp b/test/unittest/ops/reduce_all_builder_test.cpp index ea8cc33..49a61ca 100644 --- a/test/unittest/ops/reduce_all_builder_test.cpp +++ b/test/unittest/ops/reduce_all_builder_test.cpp @@ -394,7 +394,6 @@ HWTEST_F(ReduceAllBuilderTest, reduceall_build_016, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - keepDimsTensor->SetBuffer(nullptr, 0); } /** @@ -415,7 +414,6 @@ HWTEST_F(ReduceAllBuilderTest, reduceall_build_017, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - coeffTensor->SetBuffer(nullptr, 0); } /** @@ -436,7 +434,6 @@ HWTEST_F(ReduceAllBuilderTest, reduceall_build_018, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - reduceToEndTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/reduce_l2_test.cpp b/test/unittest/ops/reduce_l2_test.cpp index 6f9d45c..972d20b 100644 --- a/test/unittest/ops/reduce_l2_test.cpp +++ b/test/unittest/ops/reduce_l2_test.cpp @@ -394,7 +394,6 @@ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_016, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - keepDimsTensor->SetBuffer(nullptr, 0); } /** @@ -415,7 +414,6 @@ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_017, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - coeffTensor->SetBuffer(nullptr, 0); } /** @@ -436,7 +434,6 @@ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_018, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - reduceToEndTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/reduce_max_builder_test.cpp b/test/unittest/ops/reduce_max_builder_test.cpp index 4b4969c..a2af096 100644 --- a/test/unittest/ops/reduce_max_builder_test.cpp +++ b/test/unittest/ops/reduce_max_builder_test.cpp @@ -394,7 +394,6 @@ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_016, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - keepDimsTensor->SetBuffer(nullptr, 0); } /** @@ -415,7 +414,6 @@ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_017, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - coeffTensor->SetBuffer(nullptr, 0); } /** @@ -436,7 +434,6 @@ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_018, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - reduceToEndTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/reduce_mean_builder_test.cpp b/test/unittest/ops/reduce_mean_builder_test.cpp index 55a44fc..98b4283 100644 --- a/test/unittest/ops/reduce_mean_builder_test.cpp +++ b/test/unittest/ops/reduce_mean_builder_test.cpp @@ -394,7 +394,6 @@ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_016, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - keepDimsTensor->SetBuffer(nullptr, 0); } /** @@ -415,7 +414,6 @@ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_017, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - coeffTensor->SetBuffer(nullptr, 0); } /** @@ -436,7 +434,6 @@ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_018, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - reduceToEndTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/reduce_min_builder_test.cpp b/test/unittest/ops/reduce_min_builder_test.cpp index 5c230a6..0dead7b 100644 --- a/test/unittest/ops/reduce_min_builder_test.cpp +++ b/test/unittest/ops/reduce_min_builder_test.cpp @@ -394,7 +394,6 @@ HWTEST_F(ReduceMinBuilderTest, reducemin_build_016, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - keepDimsTensor->SetBuffer(nullptr, 0); } /** @@ -415,7 +414,6 @@ HWTEST_F(ReduceMinBuilderTest, reducemin_build_017, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - coeffTensor->SetBuffer(nullptr, 0); } /** @@ -436,7 +434,6 @@ HWTEST_F(ReduceMinBuilderTest, reducemin_build_018, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - reduceToEndTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/reduce_prod_builder_test.cpp b/test/unittest/ops/reduce_prod_builder_test.cpp index 29a0285..cfb6885 100644 --- a/test/unittest/ops/reduce_prod_builder_test.cpp +++ b/test/unittest/ops/reduce_prod_builder_test.cpp @@ -394,7 +394,6 @@ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_016, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - keepDimsTensor->SetBuffer(nullptr, 0); } /** @@ -415,7 +414,6 @@ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_017, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - coeffTensor->SetBuffer(nullptr, 0); } /** @@ -436,7 +434,6 @@ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_018, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - reduceToEndTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/reduce_sum_builder_test.cpp b/test/unittest/ops/reduce_sum_builder_test.cpp index a118cc4..0da7d0f 100644 --- a/test/unittest/ops/reduce_sum_builder_test.cpp +++ b/test/unittest/ops/reduce_sum_builder_test.cpp @@ -394,7 +394,6 @@ HWTEST_F(ReduceSumBuilderTest, reducesum_build_016, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - keepDimsTensor->SetBuffer(nullptr, 0); } /** @@ -415,7 +414,6 @@ HWTEST_F(ReduceSumBuilderTest, reducesum_build_017, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - coeffTensor->SetBuffer(nullptr, 0); } /** @@ -436,7 +434,6 @@ HWTEST_F(ReduceSumBuilderTest, reducesum_build_018, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - reduceToEndTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/space_to_depth_test.cpp b/test/unittest/ops/space_to_depth_test.cpp index a528c36..ada7357 100644 --- a/test/unittest/ops/space_to_depth_test.cpp +++ b/test/unittest/ops/space_to_depth_test.cpp @@ -168,7 +168,6 @@ HWTEST_F(SpaceToDepthBuilderTest, space_to_depth_build_007, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - blockSizeTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/tile_builder_test.cpp b/test/unittest/ops/tile_builder_test.cpp index 3e2bda3..64bc7e3 100644 --- a/test/unittest/ops/tile_builder_test.cpp +++ b/test/unittest/ops/tile_builder_test.cpp @@ -175,7 +175,6 @@ HWTEST_F(TileBuilderTest, tile_build_007, TestSize.Level0) OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - dimsTensor->SetBuffer(nullptr, 0); } /** diff --git a/test/unittest/ops/unstack_test.cpp b/test/unittest/ops/unstack_test.cpp index 5076a5a..98595a1 100644 --- a/test/unittest/ops/unstack_test.cpp +++ b/test/unittest/ops/unstack_test.cpp @@ -148,7 +148,6 @@ HWTEST_F(UnstackBuilderTest, unstack_build_006, TestSize.Level1) OH_NN_ReturnCode ret = m_builder.Build(m_params, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); - axisTensor->SetBuffer(nullptr, 0); } /** -- Gitee From 554457526fe30a2ddcc627eee55ae42d1a7cdb00 Mon Sep 17 00:00:00 2001 From: wang-yangsong Date: Fri, 31 May 2024 16:18:21 +0800 Subject: [PATCH 2/3] fix slice bug Signed-off-by: wang-yangsong --- test/unittest/ops/slice_builder_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unittest/ops/slice_builder_test.cpp b/test/unittest/ops/slice_builder_test.cpp index dd1b812..3022763 100644 --- a/test/unittest/ops/slice_builder_test.cpp +++ b/test/unittest/ops/slice_builder_test.cpp @@ -47,6 +47,7 @@ void SliceBuilderTest::InitTensor(const std::vector& inputsIndex, std::vector inputDim = {3, 2, 3}; std::vector OutputDim = {1, 1, 3}; + m_paramsIndex = paramsIndex; SaveInputTensor(inputsIndex, OH_NN_FLOAT32, inputDim, nullptr); SaveOutputTensor(outputsIndex, OH_NN_FLOAT32, OutputDim, nullptr); } @@ -204,7 +205,6 @@ HWTEST_F(SliceBuilderTest, slice_build_008, TestSize.Level0) SaveOutputTensor(outputsIndex, OH_NN_FLOAT32, OutputDim, nullptr); SaveAxesTensor(OH_NN_INT64, paramsDim, nullptr, OH_NN_MUL_ACTIVATION_TYPE); - OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); } -- Gitee From 474fb134a16b14c12f0b2551c17728801b3821e2 Mon Sep 17 00:00:00 2001 From: wang-yangsong Date: Wed, 5 Jun 2024 11:21:33 +0800 Subject: [PATCH 3/3] fix bug Signed-off-by: wang-yangsong --- test/unittest/ops/detection_post_process_test.cpp | 4 ++-- test/unittest/ops/lstm_test.cpp | 4 ++-- test/unittest/ops/reduce_all_builder_test.cpp | 14 +++++++------- test/unittest/ops/reduce_l2_test.cpp | 14 +++++++------- test/unittest/ops/reduce_max_builder_test.cpp | 14 +++++++------- test/unittest/ops/reduce_mean_builder_test.cpp | 14 +++++++------- test/unittest/ops/reduce_min_builder_test.cpp | 14 +++++++------- test/unittest/ops/reduce_prod_builder_test.cpp | 14 +++++++------- test/unittest/ops/reduce_sum_builder_test.cpp | 14 +++++++------- test/unittest/ops/topk_builder_test.cpp | 10 ++++------ 10 files changed, 57 insertions(+), 59 deletions(-) diff --git a/test/unittest/ops/detection_post_process_test.cpp b/test/unittest/ops/detection_post_process_test.cpp index da34b7a..c64c7de 100644 --- a/test/unittest/ops/detection_post_process_test.cpp +++ b/test/unittest/ops/detection_post_process_test.cpp @@ -1091,7 +1091,7 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_035, Test SetDetectionsPerClass(OH_NN_INT64, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_DETECTIONS_PER_CLASS); SetMaxClassesPerDetection(OH_NN_INT64, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_MAX_CLASSES_PER_DETECTION); SetNumClasses(OH_NN_INT64, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_NUM_CLASSES); - std::shared_ptr useRegularNmsTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr useRegularNmsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_USE_REGULAR_NMS); m_allTensors.emplace_back(useRegularNmsTensor); SetOutQuantized(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_OUT_QUANTIZED); @@ -1119,7 +1119,7 @@ HWTEST_F(DetectionPostProcessBuilderTest, detection_post_process_build_036, Test SetMaxClassesPerDetection(OH_NN_INT64, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_MAX_CLASSES_PER_DETECTION); SetNumClasses(OH_NN_INT64, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_NUM_CLASSES); SetUseRegularNms(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_USE_REGULAR_NMS); - std::shared_ptr outQuantizedTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr outQuantizedTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_DETECTION_POST_PROCESS_OUT_QUANTIZED); m_allTensors.emplace_back(outQuantizedTensor); diff --git a/test/unittest/ops/lstm_test.cpp b/test/unittest/ops/lstm_test.cpp index 4158129..d94131f 100644 --- a/test/unittest/ops/lstm_test.cpp +++ b/test/unittest/ops/lstm_test.cpp @@ -610,7 +610,7 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_015, TestSize.Level1) SaveDropout(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_LSTM_DROPOUT); SaveZoneoutCell(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_LSTM_ZONEOUT_CELL); std::shared_ptr zoneoutHiddenTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, - nullptr, OH_NN_LSTM_ZONEOUT_CELL); + nullptr, OH_NN_LSTM_ZONEOUT_HIDDEN); int64_t* zoneoutHiddenValue = new (std::nothrow) int64_t [1]{0}; EXPECT_NE(nullptr, zoneoutHiddenValue); zoneoutHiddenTensor->SetBuffer(zoneoutHiddenValue, sizeof(int64_t)); @@ -1161,7 +1161,7 @@ HWTEST_F(LSTMBuilderTest, LSTM_build_036, TestSize.Level1) SaveDropout(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_LSTM_DROPOUT); SaveZoneoutCell(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_LSTM_ZONEOUT_CELL); std::shared_ptr zoneoutHiddenTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDim, - nullptr, OH_NN_LSTM_ZONEOUT_CELL); + nullptr, OH_NN_LSTM_ZONEOUT_HIDDEN); m_allTensors.emplace_back(zoneoutHiddenTensor); SaveProjSize(OH_NN_INT64, m_paramDim, nullptr, OH_NN_LSTM_PROJ_SIZE); diff --git a/test/unittest/ops/reduce_all_builder_test.cpp b/test/unittest/ops/reduce_all_builder_test.cpp index 49a61ca..eb8b678 100644 --- a/test/unittest/ops/reduce_all_builder_test.cpp +++ b/test/unittest/ops/reduce_all_builder_test.cpp @@ -257,12 +257,12 @@ HWTEST_F(ReduceAllBuilderTest, reduceall_build_009, TestSize.Level0) */ HWTEST_F(ReduceAllBuilderTest, reduceall_build_010, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); - std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_ALL_KEEP_DIMS); bool keepDimsValue[2] = {true, true}; keepDimsTensor->SetBuffer(keepDimsValue, 2 * sizeof(bool)); @@ -282,13 +282,13 @@ HWTEST_F(ReduceAllBuilderTest, reduceall_build_010, TestSize.Level0) */ HWTEST_F(ReduceAllBuilderTest, reduceall_build_011, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_ALL_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDims, nullptr, OH_NN_REDUCE_ALL_COEFF); float coeffValue[2] = {1.0f, 1.0f}; coeffTensor->SetBuffer(coeffValue, 2 * sizeof(float)); @@ -307,14 +307,14 @@ HWTEST_F(ReduceAllBuilderTest, reduceall_build_011, TestSize.Level0) */ HWTEST_F(ReduceAllBuilderTest, reduceall_build_012, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_ALL_KEEP_DIMS); SetCoeff(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_ALL_COEFF); - std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_ALL_REDUCE_TO_END); bool reduceToEndValue[2] = {true, true}; reduceToEndTensor->SetBuffer(reduceToEndValue, 2 * sizeof(bool)); @@ -407,7 +407,7 @@ HWTEST_F(ReduceAllBuilderTest, reduceall_build_017, TestSize.Level0) SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_ALL_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_ALL_COEFF); m_allTensors.emplace_back(coeffTensor); SetReduceToEnd(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_ALL_REDUCE_TO_END); diff --git a/test/unittest/ops/reduce_l2_test.cpp b/test/unittest/ops/reduce_l2_test.cpp index 972d20b..ac85036 100644 --- a/test/unittest/ops/reduce_l2_test.cpp +++ b/test/unittest/ops/reduce_l2_test.cpp @@ -257,12 +257,12 @@ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_009, TestSize.Level0) */ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_010, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); - std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_L2_KEEP_DIMS); bool keepDimsValue[2] = {true, true}; keepDimsTensor->SetBuffer(keepDimsValue, 2 * sizeof(bool)); @@ -282,13 +282,13 @@ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_010, TestSize.Level0) */ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_011, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_L2_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDims, nullptr, OH_NN_REDUCE_L2_COEFF); float coeffValue[2] = {1.0f, 1.0f}; coeffTensor->SetBuffer(coeffValue, 2 * sizeof(float)); @@ -307,14 +307,14 @@ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_011, TestSize.Level0) */ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_012, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_L2_KEEP_DIMS); SetCoeff(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_L2_COEFF); - std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_L2_REDUCE_TO_END); bool reduceToEndValue[2] = {true, true}; reduceToEndTensor->SetBuffer(reduceToEndValue, 2 * sizeof(bool)); @@ -407,7 +407,7 @@ HWTEST_F(ReduceL2BuilderTest, reduceL2_build_017, TestSize.Level0) SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_L2_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_L2_COEFF); m_allTensors.emplace_back(coeffTensor); SetReduceToEnd(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_L2_REDUCE_TO_END); diff --git a/test/unittest/ops/reduce_max_builder_test.cpp b/test/unittest/ops/reduce_max_builder_test.cpp index a2af096..38c86e1 100644 --- a/test/unittest/ops/reduce_max_builder_test.cpp +++ b/test/unittest/ops/reduce_max_builder_test.cpp @@ -257,12 +257,12 @@ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_009, TestSize.Level0) */ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_010, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); - std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_MAX_KEEP_DIMS); bool keepDimsValue[2] = {true, true}; keepDimsTensor->SetBuffer(keepDimsValue, 2 * sizeof(bool)); @@ -282,13 +282,13 @@ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_010, TestSize.Level0) */ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_011, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MAX_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDims, nullptr, OH_NN_REDUCE_MAX_COEFF); float coeffValue[2] = {1.0f, 1.0f}; coeffTensor->SetBuffer(coeffValue, 2 * sizeof(float)); @@ -307,14 +307,14 @@ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_011, TestSize.Level0) */ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_012, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MAX_KEEP_DIMS); SetCoeff(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_MAX_COEFF); - std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_MAX_REDUCE_TO_END); bool reduceToEndValue[2] = {true, true}; reduceToEndTensor->SetBuffer(reduceToEndValue, 2 * sizeof(bool)); @@ -407,7 +407,7 @@ HWTEST_F(ReduceMaxBuilderTest, reducemax_build_017, TestSize.Level0) SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MAX_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_MAX_COEFF); m_allTensors.emplace_back(coeffTensor); SetReduceToEnd(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MAX_REDUCE_TO_END); diff --git a/test/unittest/ops/reduce_mean_builder_test.cpp b/test/unittest/ops/reduce_mean_builder_test.cpp index 98b4283..bec1e03 100644 --- a/test/unittest/ops/reduce_mean_builder_test.cpp +++ b/test/unittest/ops/reduce_mean_builder_test.cpp @@ -257,13 +257,13 @@ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_009, TestSize.Level0) */ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_010, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, - m_paramDim, nullptr, OH_NN_REDUCE_MEAN_KEEP_DIMS); + m_paramDims, nullptr, OH_NN_REDUCE_MEAN_KEEP_DIMS); bool keepDimsValue[2] = {true, true}; keepDimsTensor->SetBuffer(keepDimsValue, 2 * sizeof(bool)); m_allTensors.emplace_back(keepDimsTensor); @@ -282,13 +282,13 @@ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_010, TestSize.Level0) */ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_011, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MEAN_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDims, nullptr, OH_NN_REDUCE_MEAN_COEFF); float coeffValue[2] = {1.0f, 1.0f}; coeffTensor->SetBuffer(coeffValue, 2 * sizeof(float)); @@ -307,14 +307,14 @@ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_011, TestSize.Level0) */ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_012, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MEAN_KEEP_DIMS); SetCoeff(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_MEAN_COEFF); - std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_MEAN_REDUCE_TO_END); bool reduceToEndValue[2] = {true, true}; reduceToEndTensor->SetBuffer(reduceToEndValue, 2 * sizeof(bool)); @@ -407,7 +407,7 @@ HWTEST_F(ReduceMeanBuilderTest, reducemean_build_017, TestSize.Level0) SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MEAN_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_MEAN_COEFF); m_allTensors.emplace_back(coeffTensor); SetReduceToEnd(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MEAN_REDUCE_TO_END); diff --git a/test/unittest/ops/reduce_min_builder_test.cpp b/test/unittest/ops/reduce_min_builder_test.cpp index 0dead7b..fd57125 100644 --- a/test/unittest/ops/reduce_min_builder_test.cpp +++ b/test/unittest/ops/reduce_min_builder_test.cpp @@ -257,12 +257,12 @@ HWTEST_F(ReduceMinBuilderTest, reducemin_build_009, TestSize.Level0) */ HWTEST_F(ReduceMinBuilderTest, reducemin_build_010, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); - std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_MIN_KEEP_DIMS); bool keepDimsValue[2] = {true, true}; keepDimsTensor->SetBuffer(keepDimsValue, 2 * sizeof(bool)); @@ -282,13 +282,13 @@ HWTEST_F(ReduceMinBuilderTest, reducemin_build_010, TestSize.Level0) */ HWTEST_F(ReduceMinBuilderTest, reducemin_build_011, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MIN_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDims, nullptr, OH_NN_REDUCE_MIN_COEFF); float coeffValue[2] = {1.0f, 1.0f}; coeffTensor->SetBuffer(coeffValue, 2 * sizeof(float)); @@ -307,14 +307,14 @@ HWTEST_F(ReduceMinBuilderTest, reducemin_build_011, TestSize.Level0) */ HWTEST_F(ReduceMinBuilderTest, reducemin_build_012, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MIN_KEEP_DIMS); SetCoeff(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_MIN_COEFF); - std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_MIN_REDUCE_TO_END); bool reduceToEndValue[2] = {true, true}; reduceToEndTensor->SetBuffer(reduceToEndValue, 2 * sizeof(bool)); @@ -407,7 +407,7 @@ HWTEST_F(ReduceMinBuilderTest, reducemin_build_017, TestSize.Level0) SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MIN_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_MIN_COEFF); m_allTensors.emplace_back(coeffTensor); SetReduceToEnd(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_MIN_REDUCE_TO_END); diff --git a/test/unittest/ops/reduce_prod_builder_test.cpp b/test/unittest/ops/reduce_prod_builder_test.cpp index cfb6885..086966f 100644 --- a/test/unittest/ops/reduce_prod_builder_test.cpp +++ b/test/unittest/ops/reduce_prod_builder_test.cpp @@ -257,13 +257,13 @@ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_009, TestSize.Level0) */ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_010, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, - m_paramDim, nullptr, OH_NN_REDUCE_PROD_KEEP_DIMS); + m_paramDims, nullptr, OH_NN_REDUCE_PROD_KEEP_DIMS); bool keepDimsValue[2] = {true, true}; keepDimsTensor->SetBuffer(keepDimsValue, 2 * sizeof(bool)); m_allTensors.emplace_back(keepDimsTensor); @@ -282,13 +282,13 @@ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_010, TestSize.Level0) */ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_011, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_PROD_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDims, nullptr, OH_NN_REDUCE_PROD_COEFF); float coeffValue[2] = {1.0f, 1.0f}; coeffTensor->SetBuffer(coeffValue, 2 * sizeof(float)); @@ -307,14 +307,14 @@ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_011, TestSize.Level0) */ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_012, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_PROD_KEEP_DIMS); SetCoeff(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_PROD_COEFF); - std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_PROD_REDUCE_TO_END); bool reduceToEndValue[2] = {true, true}; reduceToEndTensor->SetBuffer(reduceToEndValue, 2 * sizeof(bool)); @@ -407,7 +407,7 @@ HWTEST_F(ReduceProdBuilderTest, reduceprod_build_017, TestSize.Level0) SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_PROD_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_PROD_COEFF); m_allTensors.emplace_back(coeffTensor); SetReduceToEnd(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_PROD_REDUCE_TO_END); diff --git a/test/unittest/ops/reduce_sum_builder_test.cpp b/test/unittest/ops/reduce_sum_builder_test.cpp index 0da7d0f..92d0c97 100644 --- a/test/unittest/ops/reduce_sum_builder_test.cpp +++ b/test/unittest/ops/reduce_sum_builder_test.cpp @@ -257,12 +257,12 @@ HWTEST_F(ReduceSumBuilderTest, reducesum_build_009, TestSize.Level0) */ HWTEST_F(ReduceSumBuilderTest, reducesum_build_010, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); - std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_SUM_KEEP_DIMS); bool keepDimsValue[2] = {true, true}; keepDimsTensor->SetBuffer(keepDimsValue, 2 * sizeof(bool)); @@ -282,13 +282,13 @@ HWTEST_F(ReduceSumBuilderTest, reducesum_build_010, TestSize.Level0) */ HWTEST_F(ReduceSumBuilderTest, reducesum_build_011, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_SUM_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDims, nullptr, OH_NN_REDUCE_SUM_COEFF); float coeffValue[2] = {1.0f, 1.0f}; coeffTensor->SetBuffer(coeffValue, 2 * sizeof(float)); @@ -307,14 +307,14 @@ HWTEST_F(ReduceSumBuilderTest, reducesum_build_011, TestSize.Level0) */ HWTEST_F(ReduceSumBuilderTest, reducesum_build_012, TestSize.Level0) { - m_paramDim = {1, 2}; + std::vector m_paramDims = {1, 2}; SaveInputTensor(m_inputs, OH_NN_BOOL, m_inputDim, nullptr); SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_SUM_KEEP_DIMS); SetCoeff(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_SUM_COEFF); - std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim, + std::shared_ptr reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDims, nullptr, OH_NN_REDUCE_SUM_REDUCE_TO_END); bool reduceToEndValue[2] = {true, true}; reduceToEndTensor->SetBuffer(reduceToEndValue, 2 * sizeof(bool)); @@ -407,7 +407,7 @@ HWTEST_F(ReduceSumBuilderTest, reducesum_build_017, TestSize.Level0) SaveOutputTensor(m_outputs, OH_NN_BOOL, m_outputDim, nullptr); SetKeepDims(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_SUM_KEEP_DIMS); - std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_INT64, + std::shared_ptr coeffTensor = TransToNNTensor(OH_NN_FLOAT32, m_paramDim, nullptr, OH_NN_REDUCE_SUM_COEFF); m_allTensors.emplace_back(coeffTensor); SetReduceToEnd(OH_NN_BOOL, m_paramDim, nullptr, OH_NN_REDUCE_SUM_REDUCE_TO_END); diff --git a/test/unittest/ops/topk_builder_test.cpp b/test/unittest/ops/topk_builder_test.cpp index b8f9bf1..4a3bdad 100644 --- a/test/unittest/ops/topk_builder_test.cpp +++ b/test/unittest/ops/topk_builder_test.cpp @@ -42,11 +42,9 @@ protected: void TopKBuilderTest::InitTensor(const std::vector& inputsIndex, const std::vector& outputsIndex) { - std::vector paramsIndex = { 4 }; std::vector inputDim = {9}; std::vector OutputDim = {3}; - m_paramsIndex = paramsIndex; SaveInputTensor(inputsIndex, OH_NN_FLOAT32, inputDim, nullptr); SaveOutputTensor(outputsIndex, OH_NN_FLOAT32, OutputDim, nullptr); } @@ -201,8 +199,8 @@ HWTEST_F(TopKBuilderTest, topk_build_007, TestSize.Level0) std::vector paramDim = {}; InitTensor(inputsIndex, outputsIndex); - SaveSortedTensor(OH_NN_INT32, paramDim, nullptr, OH_NN_TOP_K_SORTED); - SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_TOP_K_AXIS); + SaveSortedTensor(OH_NN_BOOL, paramDim, nullptr, OH_NN_TOP_K_SORTED); + SaveAxisTensor(OH_NN_INT32, paramDim, nullptr, OH_NN_TOP_K_AXIS); OH_NN_ReturnCode ret = m_builder.Build(paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors); EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret); @@ -245,7 +243,7 @@ HWTEST_F(TopKBuilderTest, topk_build_009, TestSize.Level0) InitTensor(inputsIndex, outputsIndex); - SaveSortedTensor(OH_NN_INT32, paramDim, nullptr, OH_NN_TOP_K_SORTED); + SaveSortedTensor(OH_NN_BOOL, paramDim, nullptr, OH_NN_TOP_K_SORTED); std::shared_ptr axisTensor = TransToNNTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_TOP_K_AXIS); axisTensor->SetBuffer(nullptr, 0); m_allTensors.emplace_back(axisTensor); @@ -323,7 +321,7 @@ HWTEST_F(TopKBuilderTest, topk_get_primitive_002, TestSize.Level0) SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_TOP_K_AXIS); int64_t axisValue = 0; - EXPECT_EQ(OH_NN_SUCCESS, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); + EXPECT_EQ(OH_NN_SUCCESS, m_builder.Build(paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors)); LiteGraphTensorPtr primitive = m_builder.GetPrimitive(); LiteGraphTensorPtr expectPrimitive = { nullptr, DestroyLiteGraphPrimitive }; EXPECT_NE(primitive, expectPrimitive); -- Gitee