!156 UT bug修复

Merge pull request !156 from 王杨淞/master
This commit is contained in:
openharmony_ci 2024-06-05 06:01:23 +00:00 committed by Gitee
commit 60d1b85bf2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
36 changed files with 60 additions and 156 deletions

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -179,13 +179,12 @@ HWTEST_F(ConstantOfShapeBuilderTest, constant_of_shape_build_007, TestSize.Level
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -194,13 +194,12 @@ HWTEST_F(CropBuilderTest, crop_build_007, TestSize.Level1)
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -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);
}
/**

View File

@ -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<NNTensor> useRegularNmsTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> 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<NNTensor> outQuantizedTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> outQuantizedTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
nullptr, OH_NN_DETECTION_POST_PROCESS_OUT_QUANTIZED);
m_allTensors.emplace_back(outQuantizedTensor);

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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<NNTensor> 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<NNTensor> 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);

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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<int32_t> 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<NNTensor> keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64,
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -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<int32_t> 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<NNTensor> keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64,
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -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<int32_t> 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<NNTensor> keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64,
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -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<int32_t> 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<NNTensor> 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<int32_t> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64,
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -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<int32_t> 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<NNTensor> keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64,
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -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<int32_t> 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<NNTensor> 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<int32_t> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64,
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -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<int32_t> 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<NNTensor> keepDimsTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64, m_paramDim,
std::shared_ptr<NNTensor> 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<int32_t> 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<NNTensor> reduceToEndTensor = TransToNNTensor(OH_NN_BOOL, m_paramDim,
std::shared_ptr<NNTensor> 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<NNTensor> coeffTensor = TransToNNTensor(OH_NN_INT64,
std::shared_ptr<NNTensor> 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);
}
/**

View File

@ -47,6 +47,7 @@ void SliceBuilderTest::InitTensor(const std::vector<uint32_t>& inputsIndex,
std::vector<int32_t> inputDim = {3, 2, 3};
std::vector<int32_t> 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);
}

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -42,11 +42,9 @@ protected:
void TopKBuilderTest::InitTensor(const std::vector<uint32_t>& inputsIndex, const std::vector<uint32_t>& outputsIndex)
{
std::vector<uint32_t> paramsIndex = { 4 };
std::vector<int32_t> inputDim = {9};
std::vector<int32_t> 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<int32_t> 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<NNTensor> 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);

View File

@ -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);
}
/**