diff --git a/test/unittest/ops/all_test.cpp b/test/unittest/ops/all_test.cpp index 933e2e6e2707f788fe0f6a65a0e538ef30f9059e..50df30561a7bed7d7fcedb4e129081ecb22536fd 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 132b091d38b0c9fefb95cbd794eb03d8c410696d..a18f073d4ca04c14dabff93e0b235ac45e8f139d 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 ab5f74bff4d53e54de2ef7b10d54ae5df4335989..26886bb3ee0c404d36d989078efcf7654193f670 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 c16d2de3fe7e04494b9409fdfecf89c31ac54645..6c0ab7f672d2a8584e2f1e42d1ddac5394c65dd6 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 cb7cbdc3f4b1907eb3fa9cba267184ed48d07a3e..bba5dd87ea8d24c6815b9eb4fd4cf864084b4125 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 e26d4bbb567f8279c6ef6f0b16b72f33d078b96d..254c0463c6c3c2b81fdcae6452d8144b868f869d 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 e52e1c783d0b7275ec25cf8a9d83d812079a905a..7efbac635fbdbe372276d671d80fc8fe525470e5 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 370e9f9fbddf3d16ddcfb95ac2f8b61263fa1fe1..77972d7ceed39de4b39ed2bc9555e54f8f644cbc 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 c71e04eb3fc130df51bf9b20e595d9fb4c3bb531..06fb369ddd08f9594eb88053aca7add81e33a966 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 9afc12d934342f3ed0956a9ccf8e75225023515b..c64c7de86621fe1923dd784e324f45d8f43ad98c 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); } /** @@ -1101,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); @@ -1129,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/exp_test.cpp b/test/unittest/ops/exp_test.cpp index d5c6ead932b847215897717449c34742b00cd98e..a25fc5b39bd2300b1605bb8af105d08f9b67abbe 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 cf61344b51133f059473d153472a691e09a3e656..02014c9c9aceea492654b1fda2be674bae6500ba 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 483e1c58e59fe90f2618710b95bf58874c460602..869151c466f149468e3edf5698f0949d3418d5ed 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 1c4aff333dadf2b470cf6d211965b0693ffb2da8..7c211adb8d497b5d4b1905071be2d483c7650967 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 9b11b7cd6e790c773f4c2a76759d519f66988ce7..85483816b1c55c9099b27e27fb79ab9ea3be4970 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 66473750b2ed08da473f527cb8d7761d16371813..8e07631545870a5c4eb0d8ece4f68ffb5dc9fa70 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 925f0ab7b456aab32eb45dfa7b4462a92b1363b4..126707316d6e89861daa659599dae5ae114561fa 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 3b5804d6af101c7fcd92b218f45baab2d1246bcf..78896781836ef1bbb12756c06da3c15db2f33be3 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 295ca05465a67830563a4bb05b8350918e7a3c77..d94131f977c06426bcc3e0f5c6d9d22eea5abf9a 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); } /** @@ -618,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)); @@ -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); } /** @@ -1174,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/maxpool_pad_test.cpp b/test/unittest/ops/maxpool_pad_test.cpp index 6228084f25e3375d36f4f7cd639e55bc70467033..cdcdbb6c1df15773eef34701948606bd7d0964e8 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 d6c1b79c3cc5eded4fa3b43222f57275fd9c2890..618ff6eda195eb866808fbdbf1ff3720069f5c72 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 5247a8012e2437c7b3f885a7cfb3de83c3547b9a..f7b7b379ea30b8ab9f4fb1491779ed1cc06872c7 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 9a046727c9c847572e0c5e6d181931126af883a5..e329d23b4ad98f753f7d445bd80cb9cac0b19594 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 e53251d57d8f5e88158fa074b428c2e2af301ea4..bd2629541195d4437042029625f4fd1606128dc8 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 ea8cc33ddc9b0d086afe5242562043da082f0f04..eb8b678cc3616ae06989396a693e7dc43a8118ff 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)); @@ -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); } /** @@ -408,14 +407,13 @@ 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); 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 6f9d45cdba1de7a59cc44f264adf0563280be397..ac850364c6e2806c9259f189180b9644e392a64c 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)); @@ -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); } /** @@ -408,14 +407,13 @@ 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); 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 4b4969c29ecfd319b28f86633c375e8e899e04c5..38c86e16c141c1724a0500fc0433926f44fe6ce0 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)); @@ -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); } /** @@ -408,14 +407,13 @@ 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); 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 55a44fc8db217028e2063a536e3bdd388e244221..bec1e03c35026dd3b82c937e6a69465a3e020056 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)); @@ -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); } /** @@ -408,14 +407,13 @@ 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); 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 5c230a63adb47cd0bbbc30649cc8c442a5b69ee5..fd57125c2c9d7faf2a021413dd55142a3e27f406 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)); @@ -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); } /** @@ -408,14 +407,13 @@ 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); 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 29a0285736338f34fc9dc01629248667c2b843ce..086966fdc5265280acb039afeabebb559cad7aa9 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)); @@ -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); } /** @@ -408,14 +407,13 @@ 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); 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 a118cc4fc4b439950d530c9c417a6f806af4dec4..92d0c9735703d7fc46e3a73699425258bf7e6ee1 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)); @@ -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); } /** @@ -408,14 +407,13 @@ 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); 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/slice_builder_test.cpp b/test/unittest/ops/slice_builder_test.cpp index dd1b81296a2996daff929e1baf0df200c060c667..302276368641bc2e48cd22366316c23b79b0285f 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); } diff --git a/test/unittest/ops/space_to_depth_test.cpp b/test/unittest/ops/space_to_depth_test.cpp index a528c361aa358b2c41811a11d3f7e2fde2560081..ada7357a898364208be5d0065102510c0a5a2d7e 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 3e2bda373ae051b41dfe7bfc0652b45ae66772b8..64bc7e37340e964a747201d1ef722de51e214387 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/topk_builder_test.cpp b/test/unittest/ops/topk_builder_test.cpp index b8f9bf1d2943cf1ccf21a26e884443e5ac833326..4a3bdad2b55e1c92c9eb8b1b4ef66a633c099b8e 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); diff --git a/test/unittest/ops/unstack_test.cpp b/test/unittest/ops/unstack_test.cpp index 5076a5a6473bd7ec347779e868d734aa04554d67..98595a1eece1dd32dceae02fa02257ba6debd594 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); } /**