UT用例新增

Signed-off-by: 周翔 <zhouxiang78@h-partners.com>
This commit is contained in:
周翔 2024-07-17 10:46:31 +08:00
parent d9559b4847
commit a2c9dc8e14
5 changed files with 1108 additions and 1104 deletions

View File

@ -991,7 +991,8 @@ HWTEST_F(NNCompilerTest, nncompilertest_restorefromcachefile_003, TestSize.Level
InnerModel innerModel;
BuildModel(innerModel);
void* model = &innerModel;
EXPECT_CALL(*((MockIDevice *) device.get()), PrepareModel(testing::A<std::shared_ptr<const mindspore::lite::LiteGraph>>(), ::testing::_, ::testing::_))
EXPECT_CALL(*((MockIDevice *) device.get()),
PrepareModel(testing::A<std::shared_ptr<const mindspore::lite::LiteGraph>>(), ::testing::_, ::testing::_))
.WillOnce(Invoke([&prepared](std::shared_ptr<const mindspore::lite::LiteGraph> model,
const ModelConfig& config,
std::shared_ptr<PreparedModel>& preparedModel) {
@ -1031,7 +1032,7 @@ HWTEST_F(NNCompilerTest, nncompilertest_savetocachebuffer_001, TestSize.Level0)
NNCompiler* nncompiler = new (std::nothrow) NNCompiler(device, backendID);
EXPECT_NE(nullptr, nncompiler);
size_t length = 10;
size_t length = 10;
size_t* modelSize = &length;
InnerModel innerModel;
BuildModel(innerModel);
@ -1166,7 +1167,8 @@ HWTEST_F(NNCompilerTest, nncompilertest_createexecutor_003, TestSize.Level0)
InnerModel innerModel;
BuildModel(innerModel);
void* model = &innerModel;
EXPECT_CALL(*((MockIDevice *) device.get()), PrepareModel(testing::A<std::shared_ptr<const mindspore::lite::LiteGraph>>(), ::testing::_, ::testing::_))
EXPECT_CALL(*((MockIDevice *) device.get()),
PrepareModel(testing::A<std::shared_ptr<const mindspore::lite::LiteGraph>>(), ::testing::_, ::testing::_))
.WillOnce(Invoke([&prepared](std::shared_ptr<const mindspore::lite::LiteGraph> model,
const ModelConfig& config,
std::shared_ptr<PreparedModel>& preparedModel) {

View File

@ -104,13 +104,13 @@ public:
MOCK_METHOD1(CreateTensor, Tensor*(TensorDesc*));
MOCK_METHOD1(DestroyTensor, OH_NN_ReturnCode(Tensor*));
std::shared_ptr<Device> GetDevice() {
std::shared_ptr<Device> GetDevice()
{
std::shared_ptr<Device> device = std::make_shared<MockIDevice>();
EXPECT_CALL(*((MockIDevice *) device.get()), AllocateBuffer(::testing::_, ::testing::_))
.WillRepeatedly(::testing::Return(OH_NN_SUCCESS));
return device;
}
// MOCK_CONST_METHOD0(GetDevice, std::shared_ptr<Device>());
MOCK_METHOD2(GetSupportedOperation, OH_NN_ReturnCode(std::shared_ptr<const mindspore::lite::LiteGraph>,
std::vector<bool>&));
};
@ -145,8 +145,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_construct_002, TestSize.Level0)
EXPECT_NE(nullptr, nnTensor);
nnTensor->SetSize(1);
float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = m_dataArry;
float dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = dataArry;
nnTensor->SetData(buffer);
nnTensor->SetFd(-1);
delete nnTensor;
@ -166,8 +166,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_construct_003, TestSize.Level0)
EXPECT_NE(nullptr, nnTensor);
nnTensor->SetSize(1);
float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = m_dataArry;
float dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = dataArry;
nnTensor->SetData(buffer);
nnTensor->SetFd(0);
delete nnTensor;
@ -238,7 +238,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_createdata_002, TestSize.Level0)
testing::Mock::AllowLeak(tensorDesc.get());
}
std::shared_ptr<Backend> Creator() {
std::shared_ptr<Backend> Creator()
{
size_t backendID = 1;
std::shared_ptr<MockIDevice> device = std::make_shared<MockIDevice>();
@ -361,7 +362,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_createdata_005, TestSize.Level0)
testing::Mock::AllowLeak(tensorDesc.get());
}
std::shared_ptr<Backend> Creator2() {
std::shared_ptr<Backend> Creator2()
{
size_t backendID = 2;
std::shared_ptr<Backend> backend = std::make_unique<NNBackend>(nullptr, backendID);
@ -403,7 +405,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_createdata_006, TestSize.Level0)
EXPECT_EQ(OH_NN_NULL_PTR, ret);
}
std::shared_ptr<Backend> Creator3() {
std::shared_ptr<Backend> Creator3()
{
size_t backendID = 3;
std::shared_ptr<MockIDevice> device = std::make_shared<MockIDevice>();
@ -429,7 +432,6 @@ std::shared_ptr<Backend> Creator3() {
std::shared_ptr<Backend> backend = std::make_unique<NNBackend>(device, backendID);
// LOGE("CreateData Creator [%{public}zu]",backend->GetBackendID());
return backend;
}
@ -468,7 +470,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_createdata_007, TestSize.Level0)
EXPECT_EQ(OH_NN_MEMORY_ERROR, ret);
}
std::shared_ptr<Backend> Creator4() {
std::shared_ptr<Backend> Creator4()
{
size_t backendID = 4;
std::shared_ptr<MockIDevice> device = std::make_shared<MockIDevice>();
@ -498,7 +501,6 @@ std::shared_ptr<Backend> Creator4() {
std::shared_ptr<Backend> backend = std::make_unique<NNBackend>(device, backendID);
// LOGE("CreateData Creator [%{public}zu]",backend->GetBackendID());
return backend;
}
@ -550,8 +552,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_createdata_009, TestSize.Level0)
NNTensor2_0* nnTensor = new (std::nothrow) NNTensor2_0(backendId);
EXPECT_NE(nullptr, nnTensor);
float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = m_dataArry;
float dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = dataArry;
nnTensor->SetData(buffer);
OH_NN_ReturnCode ret = nnTensor->CreateData();
@ -674,8 +676,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_createdata_024, TestSize.Level0)
NNTensor2_0* nnTensor = new (std::nothrow) NNTensor2_0(backendId);
EXPECT_NE(nullptr, nnTensor);
float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = m_dataArry;
float dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = dataArry;
nnTensor->SetData(buffer);
size_t size = 1;
@ -696,8 +698,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_createdata_029, TestSize.Level0)
NNTensor2_0* nnTensor = new (std::nothrow) NNTensor2_0(backendId);
EXPECT_NE(nullptr, nnTensor);
float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = m_dataArry;
float dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = dataArry;
nnTensor->SetData(buffer);
int fd = 1;
@ -1142,8 +1144,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_checktensordata_005, TestSize.Level0)
nnTensor->SetSize(200);
nnTensor->SetOffset(0);
float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = m_dataArry;
float dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = dataArry;
nnTensor->SetData(buffer);
nnTensor->SetFd(-1);
@ -1177,8 +1179,8 @@ HWTEST_F(NNTensor2_0Test, nntensor2_0test_checktensordata_006, TestSize.Level0)
nnTensor->SetSize(200);
nnTensor->SetOffset(0);
float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = m_dataArry;
float dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* buffer = dataArry;
nnTensor->SetData(buffer);
bool ret = nnTensor->CheckTensorData();

View File

@ -836,8 +836,8 @@ HWTEST_F(HDIDeviceTest, hdidevice_preparemodel_005, TestSize.Level0)
std::unique_ptr<HDIDeviceV1_0> hdiDevice = std::make_unique<HDIDeviceV1_0>(sp);
EXPECT_NE(hdiDevice, nullptr);
float m_dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* data = m_dataArry;
float dataArry[9] {0, 1, 2, 3, 4, 5, 6, 7, 8};
void* data = dataArry;
ModelConfig config;
std::shared_ptr<PreparedModel> preparedModel;
OH_NN_ReturnCode result = hdiDevice->PrepareModel(data, config, preparedModel);
@ -1626,8 +1626,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
int8_t num = 1;
int8_t* fuseData = &num;
mindspore::lite::ActivationType m_activationType = NNToMS::TransfromFusionType(static_cast<OH_NN_FuseType>(*fuseData));
void* primitive = mindspore::lite::MindIR_AddFusion_CreatePrimitive(m_activationType);
mindspore::lite::ActivationType activationType = NNToMS::TransfromFusionType(static_cast<OH_NN_FuseType>(*fuseData));
void* primitive = mindspore::lite::MindIR_AddFusion_CreatePrimitive(activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1652,8 +1652,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_keepDims {0};
void* primitive = mindspore::lite::MindIR_All_CreatePrimitive(m_keepDims);
int64_t keepDims {0};
void* primitive = mindspore::lite::MindIR_All_CreatePrimitive(keepDims);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1678,11 +1678,11 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis {-1};
int64_t m_topK {1};
bool m_keepDims {false};
bool m_outMaxValue {false};
void* primitive = mindspore::lite::MindIR_ArgMaxFusion_CreatePrimitive(m_axis, m_topK, m_keepDims, m_outMaxValue);
int64_t axis {-1};
int64_t topK {1};
bool keepDims {false};
bool outMaxValue {false};
void* primitive = mindspore::lite::MindIR_ArgMaxFusion_CreatePrimitive(axis, topK, keepDims, outMaxValue);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1707,8 +1707,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_summarize {0};
void* primitive = mindspore::lite::MindIR_Assert_CreatePrimitive(m_summarize);
int64_t summarize {0};
void* primitive = mindspore::lite::MindIR_Assert_CreatePrimitive(summarize);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1733,16 +1733,16 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_kernelSize;
std::vector<int64_t> m_pad;
std::vector<int64_t> m_strides;
mindspore::lite::PadMode m_padMode {mindspore::lite::PAD_MODE_PAD};
mindspore::lite::ActivationType m_activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
mindspore::lite::RoundMode m_roundMode {mindspore::lite::ROUND_MODE_FLOOR};
mindspore::lite::Format m_format {mindspore::lite::FORMAT_NCHW};
bool m_global {false};
void* primitive = mindspore::lite::MindIR_AvgPoolFusion_CreatePrimitive(m_kernelSize, m_strides, m_pad,
m_padMode, m_roundMode, m_format, m_global, m_activationType);
std::vector<int64_t> kernelSize;
std::vector<int64_t> pad;
std::vector<int64_t> strides;
mindspore::lite::PadMode padMode {mindspore::lite::PAD_MODE_PAD};
mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
mindspore::lite::RoundMode roundMode {mindspore::lite::ROUND_MODE_FLOOR};
mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
bool global {false};
void* primitive = mindspore::lite::MindIR_AvgPoolFusion_CreatePrimitive(kernelSize, strides, pad,
padMode, roundMode, format, global, activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1767,9 +1767,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_blockSize;
std::vector<std::vector<int64_t>> m_crops;
void* primitive = mindspore::lite::MindIR_BatchToSpaceND_CreatePrimitive(m_blockSize, m_crops);
std::vector<int64_t> blockSize;
std::vector<std::vector<int64_t>> crops;
void* primitive = mindspore::lite::MindIR_BatchToSpaceND_CreatePrimitive(blockSize, crops);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1794,8 +1794,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
float m_epsilon {0.0001f};
void* primitive = mindspore::lite::MindIR_FusedBatchNorm_CreatePrimitive(m_epsilon);
float epsilon {0.0001f};
void* primitive = mindspore::lite::MindIR_FusedBatchNorm_CreatePrimitive(epsilon);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1820,8 +1820,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
float m_epsilon {0.0001f};
void* primitive = mindspore::lite::MindIR_FusedBatchNorm_CreatePrimitive(m_epsilon);
float epsilon {0.0001f};
void* primitive = mindspore::lite::MindIR_FusedBatchNorm_CreatePrimitive(epsilon);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1871,8 +1871,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_shape;
void* primitive = mindspore::lite::MindIR_BroadcastTo_CreatePrimitive(m_shape);
std::vector<int64_t> shape;
void* primitive = mindspore::lite::MindIR_BroadcastTo_CreatePrimitive(shape);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1947,9 +1947,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
float m_max {0.0f};
float m_min {0.0f};
void* primitive = mindspore::lite::MindIR_Clip_CreatePrimitive(m_max, m_min);
float max {0.0f};
float min {0.0f};
void* primitive = mindspore::lite::MindIR_Clip_CreatePrimitive(max, min);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -1974,8 +1974,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis{0};
void* primitive = mindspore::lite::MindIR_Concat_CreatePrimitive(m_axis);
int64_t axis{0};
void* primitive = mindspore::lite::MindIR_Concat_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2000,9 +2000,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_dataType {0};
std::vector<float> m_value;
void* primitive = mindspore::lite::MindIR_ConstantOfShape_CreatePrimitive(m_dataType, m_value);
int64_t dataType {0};
std::vector<float> value;
void* primitive = mindspore::lite::MindIR_ConstantOfShape_CreatePrimitive(dataType, value);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2027,19 +2027,19 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_group {1};
int64_t m_inChannel {0};
int64_t m_outChannel {0};
std::vector<int64_t> m_kernelSize;
std::vector<int64_t> m_strides;
std::vector<int64_t> m_padList;
std::vector<int64_t> m_dilation;
std::vector<int64_t> m_outputPaddings;
mindspore::lite::PadMode m_padMode{mindspore::lite::PAD_MODE_PAD};
mindspore::lite::ActivationType m_activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = MindIR_Conv2dTransposeFusion_CreatePrimitive(m_kernelSize,
m_strides, m_dilation, m_padMode, m_padList, m_group, m_inChannel, m_outChannel,
m_activationType, m_outputPaddings);
int64_t group {1};
int64_t inChannel {0};
int64_t outChannel {0};
std::vector<int64_t> kernelSize;
std::vector<int64_t> strides;
std::vector<int64_t> padList;
std::vector<int64_t> dilation;
std::vector<int64_t> outputPaddings;
mindspore::lite::PadMode padMode{mindspore::lite::PAD_MODE_PAD};
mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = MindIR_Conv2dTransposeFusion_CreatePrimitive(kernelSize,
strides, dilation, padMode, padList, group, inChannel, outChannel,
activationType, outputPaddings);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2089,9 +2089,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis {0};
std::vector<int64_t> m_offset;
void* primitive = mindspore::lite::MindIR_Crop_CreatePrimitive(m_axis, m_offset);
int64_t axis {0};
std::vector<int64_t> offset;
void* primitive = mindspore::lite::MindIR_Crop_CreatePrimitive(axis, offset);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2116,10 +2116,10 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_blockSize {0};
std::string m_mode;
int64_t blockSize {0};
std::string mode;
mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
void* primitive = mindspore::lite::MindIR_DepthToSpace_CreatePrimitive(m_blockSize, format, m_mode);
void* primitive = mindspore::lite::MindIR_DepthToSpace_CreatePrimitive(blockSize, format, mode);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2144,20 +2144,20 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_inputSize {0};
std::vector<float> m_scale;
float m_nmsIoUThreshold {0.0f};
float m_nmsScoreThreshold {0.0f};
int64_t m_maxDetections {0};
int64_t m_detectionsPerClass {0};
int64_t m_maxClassesPerDetection {0};
int64_t m_numClasses {0};
bool m_useRegularNms {false};
bool m_outQuantized {false};
int64_t inputSize {0};
std::vector<float> scale;
float nmsIoUThreshold {0.0f};
float nmsScoreThreshold {0.0f};
int64_t maxDetections {0};
int64_t detectionsPerClass {0};
int64_t maxClassesPerDetection {0};
int64_t numClasses {0};
bool useRegularNms {false};
bool outQuantized {false};
mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
void* primitive = mindspore::lite::MindIR_DetectionPostProcess_CreatePrimitive(format, m_inputSize, m_scale,
m_nmsIoUThreshold, m_nmsScoreThreshold, m_maxDetections, m_detectionsPerClass, m_maxClassesPerDetection,
m_numClasses, m_useRegularNms, m_outQuantized);
void* primitive = mindspore::lite::MindIR_DetectionPostProcess_CreatePrimitive(format, inputSize, scale,
nmsIoUThreshold, nmsScoreThreshold, maxDetections, detectionsPerClass, maxClassesPerDetection,
numClasses, useRegularNms, outQuantized);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2182,8 +2182,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
mindspore::lite::EltwiseMode m_mode {mindspore::lite::ELTWISE_MODE_PROD};
void* primitive = mindspore::lite::MindIR_Eltwise_CreatePrimitive(m_mode);
mindspore::lite::EltwiseMode mode {mindspore::lite::ELTWISE_MODE_PROD};
void* primitive = mindspore::lite::MindIR_Eltwise_CreatePrimitive(mode);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2258,10 +2258,10 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
float m_base {-1.0f};
float m_scale {1.0f};
float m_shift {0.0f};
void* primitive = mindspore::lite::MindIR_ExpFusion_CreatePrimitive(m_base, m_scale, m_shift);
float base {-1.0f};
float scale {1.0f};
float shift {0.0f};
void* primitive = mindspore::lite::MindIR_ExpFusion_CreatePrimitive(base, scale, shift);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2336,8 +2336,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis {1};
void* primitive = mindspore::lite::MindIR_Flatten_CreatePrimitive(m_axis);
int64_t axis {1};
void* primitive = mindspore::lite::MindIR_Flatten_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2387,12 +2387,12 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
bool m_hasBias {false};
bool m_useAxis {false};
int64_t m_axis {0};
mindspore::lite::ActivationType m_activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_FullConnection_CreatePrimitive(m_hasBias, m_useAxis,
m_axis, m_activationType);
bool hasBias {false};
bool useAxis {false};
int64_t axis {0};
mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_FullConnection_CreatePrimitive(hasBias, useAxis,
axis, activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2471,9 +2471,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
float alpha = 0.0f;
float minVal = 0.0f;
float maxVal = 0.0f;
bool m_approximate = false;
bool approximate = false;
void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType,
alpha, minVal, maxVal, m_approximate);
alpha, minVal, maxVal, approximate);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2579,8 +2579,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
float m_epsilon {0.0f};
void* primitive = mindspore::lite::MindIR_InstanceNorm_CreatePrimitive(m_epsilon);
float epsilon {0.0f};
void* primitive = mindspore::lite::MindIR_InstanceNorm_CreatePrimitive(epsilon);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2605,8 +2605,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
float m_epsilon {0.0f};
void* primitive = mindspore::lite::MindIR_InstanceNorm_CreatePrimitive(m_epsilon);
float epsilon {0.0f};
void* primitive = mindspore::lite::MindIR_InstanceNorm_CreatePrimitive(epsilon);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2631,10 +2631,10 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_axis;
float m_epsilon {1e-6};
mindspore::lite::ActivationType m_activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_L2NormalizeFusion_CreatePrimitive(m_axis, m_epsilon, m_activationType);
std::vector<int64_t> axis;
float epsilon {1e-6};
mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_L2NormalizeFusion_CreatePrimitive(axis, epsilon, activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2659,12 +2659,12 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_beginNormAxis {1};
float m_epsilon {1e-7};
bool m_elementwiseAffine {true};
int64_t m_beginParamsAxis {1};
void* primitive = mindspore::lite::MindIR_LayerNormFusion_CreatePrimitive(m_beginNormAxis,
m_epsilon, m_elementwiseAffine, m_beginParamsAxis);
int64_t beginNormAxis {1};
float epsilon {1e-7};
bool elementwiseAffine {true};
int64_t beginParamsAxis {1};
void* primitive = mindspore::lite::MindIR_LayerNormFusion_CreatePrimitive(beginNormAxis,
epsilon, elementwiseAffine, beginParamsAxis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2795,8 +2795,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis {0};
void* primitive = mindspore::lite::MindIR_LogSoftmax_CreatePrimitive(m_axis);
int64_t axis {0};
void* primitive = mindspore::lite::MindIR_LogSoftmax_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2896,13 +2896,13 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_depthRadius {0};
float m_bias {0.0f};
float m_alpha {0.0f};
float m_beta {0.0f};
std::string m_normRegion {"ACROSS_CHANNELS"};
void* primitive = mindspore::lite::MindIR_LRN_CreatePrimitive(m_depthRadius, m_bias, m_alpha,
m_beta, m_normRegion);
int64_t depthRadius {0};
float bias {0.0f};
float alpha {0.0f};
float beta {0.0f};
std::string normRegion {"ACROSS_CHANNELS"};
void* primitive = mindspore::lite::MindIR_LRN_CreatePrimitive(depthRadius, bias, alpha,
beta, normRegion);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2927,18 +2927,18 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
bool m_bidirectional {false};
bool m_hasBias {false};
int64_t m_inputSize {0};
int64_t m_hiddenSize {0};
int64_t m_numLayers {0};
int64_t m_numDirections {0};
float m_dropout {0.0f};
float m_zoneoutCell {0.0f};
float m_zoneoutHidden {0.0f};
int64_t m_projSize {0};
void* primitive = mindspore::lite::MindIR_LSTM_CreatePrimitive(m_bidirectional, m_hasBias, m_inputSize,
m_hiddenSize, m_numLayers, m_numDirections, m_dropout, m_zoneoutCell, m_zoneoutHidden, m_projSize);
bool bidirectional {false};
bool hasBias {false};
int64_t inputSize {0};
int64_t hiddenSize {0};
int64_t numLayers {0};
int64_t numDirections {0};
float dropout {0.0f};
float zoneoutCell {0.0f};
float zoneoutHidden {0.0f};
int64_t projSize {0};
void* primitive = mindspore::lite::MindIR_LSTM_CreatePrimitive(bidirectional, hasBias, inputSize,
hiddenSize, numLayers, numDirections, dropout, zoneoutCell, zoneoutHidden, projSize);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -2988,15 +2988,15 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_kernelSize;
std::vector<int64_t> m_pad;
std::vector<int64_t> m_strides;
mindspore::lite::PadMode m_padMode {mindspore::lite::PAD_MODE_PAD};
mindspore::lite::ActivationType m_activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
mindspore::lite::Format m_format {mindspore::lite::FORMAT_NCHW};
bool m_global {false};
void* primitive = MindIR_MaxPoolFusion_CreatePrimitive(m_kernelSize, m_strides, m_pad,
m_padMode, m_format, m_global, m_activationType);
std::vector<int64_t> kernelSize;
std::vector<int64_t> pad;
std::vector<int64_t> strides;
mindspore::lite::PadMode padMode {mindspore::lite::PAD_MODE_PAD};
mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
bool global {false};
void* primitive = MindIR_MaxPoolFusion_CreatePrimitive(kernelSize, strides, pad,
padMode, format, global, activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3071,8 +3071,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
mindspore::lite::ActivationType m_activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_MulFusion_CreatePrimitive(m_activationType);
mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_MulFusion_CreatePrimitive(activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3147,8 +3147,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis {-1};
void* primitive = mindspore::lite::MindIR_OneHot_CreatePrimitive(m_axis);
int64_t axis {-1};
void* primitive = mindspore::lite::MindIR_OneHot_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3174,9 +3174,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<std::vector<int64_t>> paddings;
float m_constantValue {0.0f};
mindspore::lite::PaddingMode m_paddingMode {mindspore::lite::PADDING_MODE_CONSTANT};
void* primitive = MindIR_PadFusion_CreatePrimitive(paddings, m_paddingMode, m_constantValue);
float constantValue {0.0f};
mindspore::lite::PaddingMode paddingMode {mindspore::lite::PADDING_MODE_CONSTANT};
void* primitive = MindIR_PadFusion_CreatePrimitive(paddings, paddingMode, constantValue);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3201,9 +3201,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
float m_scale {1.0f};
float m_shift {0.0f};
void* primitive = mindspore::lite::MindIR_PowFusion_CreatePrimitive(m_scale, m_shift);
float scale {1.0f};
float shift {0.0f};
void* primitive = mindspore::lite::MindIR_PowFusion_CreatePrimitive(scale, shift);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3254,10 +3254,10 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
const uint64_t* m_src_t{nullptr};
const uint64_t* m_dst_t{nullptr};
int64_t m_axis {0};
void* primitive = mindspore::lite::MindIR_QuantDTypeCast_CreatePrimitive(*m_src_t, *m_dst_t, m_axis);
const uint64_t* srcT{nullptr};
const uint64_t* dstT{nullptr};
int64_t axis {0};
void* primitive = mindspore::lite::MindIR_QuantDTypeCast_CreatePrimitive(*srcT, *dstT, axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3283,10 +3283,10 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t dType {0.0f};
int64_t m_start {0};
int64_t m_limit {0};
int64_t m_delta {1};
void* primitive = mindspore::lite::MindIR_Range_CreatePrimitive(dType, m_start, m_limit, m_delta);
int64_t start {0};
int64_t limit {0};
int64_t delta {1};
void* primitive = mindspore::lite::MindIR_Range_CreatePrimitive(dType, start, limit, delta);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3362,10 +3362,10 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
mindspore::lite::ReduceMode mode {mindspore::lite::REDUCE_MODE_ALL};
float m_coeff {0.0f};
bool m_reduceToEnd {false};
bool m_keepDims {false};
void* primitive = mindspore::lite::MindIR_ReduceFusion_CreatePrimitive(m_keepDims, mode, m_reduceToEnd, m_coeff);
float coeff {0.0f};
bool reduceToEnd {false};
bool keepDims {false};
void* primitive = mindspore::lite::MindIR_ReduceFusion_CreatePrimitive(keepDims, mode, reduceToEnd, coeff);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3449,15 +3449,15 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
float cubicCoeff{0.0f};
float extrapolationValue{0.0f};
mindspore::lite::NearestMode nearestMode{mindspore::lite::NEAREST_MODE_NORMAL};
mindspore::lite::ResizeMethod m_method {mindspore::lite::RESIZE_METHOD_LINEAR};
uint64_t m_newHeight{0};
uint64_t m_newWidth{0};
bool m_preserveAspectRatio{false};
mindspore::lite::CoordinateTransformMode m_coordinateTransformMode {
mindspore::lite::ResizeMethod method {mindspore::lite::RESIZE_METHOD_LINEAR};
uint64_t newHeight{0};
uint64_t newWidth{0};
bool preserveAspectRatio{false};
mindspore::lite::CoordinateTransformMode coordinateTransformMode {
mindspore::lite::COORDINATE_TRANSFORM_MODE_ASYMMETRIC};
uint64_t m_excludeOutside{0};
void* primitive = mindspore::lite::MindIR_Resize_CreatePrimitive(m_method, m_newHeight, m_newWidth,
m_preserveAspectRatio, m_coordinateTransformMode, cubicCoeff, m_excludeOutside,
uint64_t excludeOutside{0};
void* primitive = mindspore::lite::MindIR_Resize_CreatePrimitive(method, newHeight, newWidth,
preserveAspectRatio, coordinateTransformMode, cubicCoeff, excludeOutside,
extrapolationValue, nearestMode);
node->name_ = "NNRt_SubGraph";
@ -3533,9 +3533,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
mindspore::lite::ActivationType m_activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
const uint64_t* m_axis{nullptr};
void* primitive = mindspore::lite::MindIR_ScaleFusion_CreatePrimitive(*m_axis, m_activationType);
mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
const uint64_t* axis{nullptr};
void* primitive = mindspore::lite::MindIR_ScaleFusion_CreatePrimitive(*axis, activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3667,8 +3667,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
int64_t m_blockSize {0};
void* primitive = mindspore::lite::MindIR_SpaceToDepth_CreatePrimitive(m_blockSize, format);
int64_t blockSize {0};
void* primitive = mindspore::lite::MindIR_SpaceToDepth_CreatePrimitive(blockSize, format);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3774,8 +3774,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis {0};
void* primitive = mindspore::lite::MindIR_Unstack_CreatePrimitive(m_axis);
int64_t axis {0};
void* primitive = mindspore::lite::MindIR_Unstack_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3850,8 +3850,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_axis;
void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(m_axis);
std::vector<int64_t> axis;
void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3876,16 +3876,16 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_inChannel{0};
int64_t m_outChannel{0};
std::vector<int64_t> m_kernelSize;
std::vector<int64_t> m_strides;
std::vector<int64_t> m_pad;
std::vector<int64_t> m_dilation;
mindspore::lite::PadMode m_padMode{mindspore::lite::PAD_MODE_PAD};
mindspore::lite::ActivationType m_activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_Conv2DFusion_CreatePrimitive(m_kernelSize, m_strides,
m_dilation, m_padMode, m_pad, m_inChannel, m_inChannel, m_outChannel, m_activationType);
int64_t inChannel{0};
int64_t outChannel{0};
std::vector<int64_t> kernelSize;
std::vector<int64_t> strides;
std::vector<int64_t> pad;
std::vector<int64_t> dilation;
mindspore::lite::PadMode padMode{mindspore::lite::PAD_MODE_PAD};
mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_Conv2DFusion_CreatePrimitive(kernelSize, strides,
dilation, padMode, pad, inChannel, inChannel, outChannel, activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3910,8 +3910,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
mindspore::lite::ActivationType m_activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_DivFusion_CreatePrimitive(m_activationType);
mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_DivFusion_CreatePrimitive(activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3936,10 +3936,10 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
mindspore::lite::ActivationType m_activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
bool m_transposeA{false};
bool m_transposeB{false};
void* primitive = mindspore::lite::MindIR_MatMulFusion_CreatePrimitive(m_transposeA, m_transposeB, m_activationType);
mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
bool transposeA{false};
bool transposeB{false};
void* primitive = mindspore::lite::MindIR_MatMulFusion_CreatePrimitive(transposeA, transposeB, activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3964,8 +3964,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_axes;
void* primitive = mindspore::lite::MindIR_SliceFusion_CreatePrimitive(m_axes);
std::vector<int64_t> axes;
void* primitive = mindspore::lite::MindIR_SliceFusion_CreatePrimitive(axes);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -3990,8 +3990,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_axis;
void* primitive = mindspore::lite::MindIR_Softmax_CreatePrimitive(m_axis);
std::vector<int64_t> axis;
void* primitive = mindspore::lite::MindIR_Softmax_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4043,10 +4043,10 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_output_num {0};
std::vector<int64_t> m_size_splits;
int64_t m_axis {0};
void* primitive = mindspore::lite::MindIR_Split_CreatePrimitive(m_output_num, m_size_splits, m_axis);
int64_t outputNum {0};
std::vector<int64_t> sizeSplits;
int64_t axis {0};
void* primitive = mindspore::lite::MindIR_Split_CreatePrimitive(outputNum, sizeSplits, axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4121,8 +4121,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_axis;
void* primitive = mindspore::lite::MindIR_Squeeze_CreatePrimitive(m_axis);
std::vector<int64_t> axis;
void* primitive = mindspore::lite::MindIR_Squeeze_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4147,8 +4147,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis = {0};
void* primitive = mindspore::lite::MindIR_Stack_CreatePrimitive(m_axis);
int64_t axis = {0};
void* primitive = mindspore::lite::MindIR_Stack_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4173,13 +4173,13 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_begin_mask = {0};
int64_t m_end_mask = {0};
int64_t m_ellipsis_mask = {0};
int64_t m_new_axis_mask = {0};
int64_t m_shrink_axis_mask = {0};
void* primitive = mindspore::lite::MindIR_StridedSlice_CreatePrimitive(m_begin_mask, m_end_mask, m_ellipsis_mask,
m_new_axis_mask, m_shrink_axis_mask);
int64_t beginMask = {0};
int64_t endMask = {0};
int64_t ellipsisMask = {0};
int64_t newAxisMask = {0};
int64_t shrinkAxisMask = {0};
void* primitive = mindspore::lite::MindIR_StridedSlice_CreatePrimitive(beginMask, endMask, ellipsisMask,
newAxisMask, shrinkAxisMask);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4204,8 +4204,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
mindspore::lite::ActivationType m_activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_SubFusion_CreatePrimitive(m_activationType);
mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
void* primitive = mindspore::lite::MindIR_SubFusion_CreatePrimitive(activationType);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4230,8 +4230,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_dims {0};
void* primitive = mindspore::lite::MindIR_TileFusion_CreatePrimitive(m_dims);
std::vector<int64_t> dims {0};
void* primitive = mindspore::lite::MindIR_TileFusion_CreatePrimitive(dims);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4256,9 +4256,9 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
int64_t m_axis {0};
bool m_sorted {true};
void* primitive = mindspore::lite::MindIR_TopKFusion_CreatePrimitive(m_sorted, m_axis);
int64_t axis {0};
bool sorted {true};
void* primitive = mindspore::lite::MindIR_TopKFusion_CreatePrimitive(sorted, axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4308,8 +4308,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_axis;
void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(m_axis);
std::vector<int64_t> axis;
void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4334,8 +4334,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
std::vector<int64_t> m_axis;
void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(m_axis);
std::vector<int64_t> axis;
void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(axis);
node->name_ = "NNRt_SubGraph";
node->quant_type_ = 1;
@ -4375,7 +4375,8 @@ HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_
OHOS::HDI::Nnrt::V1_0::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
EXPECT_NE(nullptr, model);
uint8_t *mmapPtr = static_cast<uint8_t *>(mmap(nullptr, tensorBuffer.bufferSize, PROT_READ | PROT_WRITE, MAP_SHARED, tensorBuffer.fd, 0));
uint8_t *mmapPtr = static_cast<uint8_t *>(mmap(nullptr,
tensorBuffer.bufferSize, PROT_READ | PROT_WRITE, MAP_SHARED, tensorBuffer.fd, 0));
EXPECT_EQ(MAP_FAILED, mmapPtr);
}

File diff suppressed because it is too large Load Diff

View File

@ -316,7 +316,8 @@ HWTEST_F(NeuralNetworkRuntimeInnerTest, oh_nnmodel_setinputsandoutputsinfo_002,
size_t inputSize = 1;
OH_NN_TensorInfo outputsInfo;
size_t outputSize = 1 ;
OH_NN_ReturnCode ret = OH_NNModel_SetInputsAndOutputsInfo(nullptr, &inputsInfo, inputSize, &outputsInfo, outputSize);
OH_NN_ReturnCode ret = OH_NNModel_SetInputsAndOutputsInfo(nullptr,
&inputsInfo, inputSize, &outputsInfo, outputSize);
EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
}