1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gmock/gmock.h>
17 #include <gtest/gtest.h>
18 
19 #include "common/utils.h"
20 #include "common/log.h"
21 #include "nn_tensor.h"
22 #include "inner_model.h"
23 
24 #include <sys/mman.h>
25 
26 #include "lite_graph_to_hdi_model_v2_1.h"
27 #include "device.h"
28 #include "interfaces/kits/c/neural_network_runtime/neural_network_runtime_type.h"
29 #include "nnbackend.h"
30 #include "ops_registry.h"
31 #include "transform.h"
32 
33 using namespace testing;
34 using namespace testing::ext;
35 using namespace OHOS::NeuralNetworkRuntime;
36 
37 namespace MSLITE = mindspore::lite;
38 
39 namespace NNRT {
40 namespace UnitTest {
41 class InnerModelTest : public testing::Test {
42 public:
43     void SetLiteGraph(mindspore::lite::LiteGraph* liteGraph);
44     void SetTensors();
45     void SetIndices();
46 
47 public:
48     InnerModel m_innerModelTest;
49 
50     std::vector<int32_t> m_dimInput {3, 3};
51     std::vector<int32_t> m_dimOutput {3, 3};
52     std::vector<uint32_t> m_inputIndices {0};
53     std::vector<uint32_t> m_outputIndices {1};
54 
55     OH_NN_OperationType m_opType {OH_NN_OPS_ADD};
56 
57     OH_NN_UInt32Array m_inputs;
58     OH_NN_UInt32Array m_outputs;
59     OH_NN_UInt32Array m_params;
60 
61     uint32_t m_paramIndexs[1] {3};
62     uint32_t m_inputIndexs[2] {0, 1};
63     uint32_t m_outputIndexs[1] {2};
64 };
65 
SetLiteGraph(mindspore::lite::LiteGraph * liteGraph)66 void InnerModelTest::SetLiteGraph(mindspore::lite::LiteGraph* liteGraph)
67 {
68     liteGraph->name_ = "testGraph";
69     liteGraph->input_indices_ = m_inputIndices;
70     liteGraph->output_indices_ = m_outputIndices;
71 
72     const std::vector<mindspore::lite::QuantParam> quant_params {};
73 
74     for (size_t indexInput = 0; indexInput < liteGraph->input_indices_.size(); ++indexInput) {
75         const std::vector<uint8_t> data(36, 1);
76         liteGraph->all_tensors_.emplace_back(mindspore::lite::MindIR_Tensor_Create());
77     }
78 
79     for (size_t indexOutput = 0; indexOutput < liteGraph->output_indices_.size(); ++indexOutput) {
80         const std::vector<uint8_t> dataOut(36, 1);
81         liteGraph->all_tensors_.emplace_back(mindspore::lite::MindIR_Tensor_Create());
82     }
83 }
84 
SetTensors()85 void InnerModelTest::SetTensors()
86 {
87     const int dim[2] = {2, 2};
88     const OH_NN_Tensor& tensor = {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR};
89 
90     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
91     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
92     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
93 
94     const OH_NN_Tensor& tensorParam = {OH_NN_INT8, 0, nullptr, nullptr, OH_NN_ADD_ACTIVATIONTYPE};
95     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensorParam));
96 }
97 
SetIndices()98 void InnerModelTest::SetIndices()
99 {
100     m_params.data = m_paramIndexs;
101     m_params.size = sizeof(m_paramIndexs) / sizeof(uint32_t);
102 
103     m_inputs.data = m_inputIndexs;
104     m_inputs.size = sizeof(m_inputIndexs) / sizeof(uint32_t);
105 
106     m_outputs.data = m_outputIndexs;
107     m_outputs.size = sizeof(m_outputIndexs) / sizeof(uint32_t);
108 }
109 
110 /**
111  * @tc.name: inner_model_construct_nntensor_from_litegraph_001
112  * @tc.desc: Verify the input_indices is empty of the construct_nntensor_from_litegraph function
113  * @tc.type: FUNC
114  */
115 HWTEST_F(InnerModelTest, inner_model_construct_nntensor_from_litegraph_001, TestSize.Level1)
116 {
117     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
118     EXPECT_NE(nullptr, liteGraph);
119     m_inputIndices = {};
120 
121     SetLiteGraph(liteGraph);
122 
123     ExtensionConfig extensionConfig;
124 
125     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest
126         .BuildFromLiteGraph(liteGraph, extensionConfig));
127 }
128 
129 /**
130  * @tc.name: inner_model_construct_nntensor_from_litegraph_002
131  * @tc.desc: Verify the input_indices is out of bounds of the construct_nntensor_from_litegraph function
132  * @tc.type: FUNC
133  */
134 HWTEST_F(InnerModelTest, inner_model_construct_nntensor_from_litegraph_002, TestSize.Level1)
135 {
136     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
137     EXPECT_NE(nullptr, liteGraph);
138     m_inputIndices = {6};
139 
140     SetLiteGraph(liteGraph);
141 
142     ExtensionConfig extensionConfig;
143 
144     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest
145         .BuildFromLiteGraph(liteGraph, extensionConfig));
146 }
147 
148 /**
149  * @tc.name: inner_model_construct_nntensor_from_litegraph_003
150  * @tc.desc: Verify the success of the construct_nntensor_from_litegraph function
151  * @tc.type: FUNC
152  */
153 HWTEST_F(InnerModelTest, inner_model_construct_nntensor_from_litegraph_003, TestSize.Level1)
154 {
155     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
156     EXPECT_NE(nullptr, liteGraph);
157 
158     SetLiteGraph(liteGraph);
159 
160     ExtensionConfig extensionConfig;
161 
162     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.BuildFromLiteGraph(liteGraph, extensionConfig));
163 }
164 
165 /**
166  * @tc.name: inner_model_construct_nntensor_from_litegraph_004
167  * @tc.desc: Verify the nntensor build failed nullptr return of the construct_nntensor_from_litegraph function
168  * @tc.type: FUNC
169  */
170 HWTEST_F(InnerModelTest, inner_model_construct_nntensor_from_litegraph_004, TestSize.Level1)
171 {
172     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
173     EXPECT_NE(nullptr, liteGraph);
174     m_dimInput = {3, -3};
175 
176     SetLiteGraph(liteGraph);
177 
178     ExtensionConfig extensionConfig;
179 
180     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.BuildFromLiteGraph(liteGraph, extensionConfig));
181 }
182 
183 /**
184  * @tc.name: inner_model_construct_nntensor_from_litegraph_005
185  * @tc.desc: Verify the output indices out of bounds of the construct_nntensor_from_litegraph function
186  * @tc.type: FUNC
187  */
188 HWTEST_F(InnerModelTest, inner_model_construct_nntensor_from_litegraph_005, TestSize.Level1)
189 {
190     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
191     EXPECT_NE(nullptr, liteGraph);
192     m_outputIndices = {6};
193 
194     SetLiteGraph(liteGraph);
195 
196     ExtensionConfig extensionConfig;
197 
198     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest
199         .BuildFromLiteGraph(liteGraph, extensionConfig));
200 }
201 
202 /**
203  * @tc.name: inner_model_buildfrommetagraph_001
204  * @tc.desc: Verify the nntensor build failed nullptr return of the construct_nntensor_from_litegraph function
205  * @tc.type: FUNC
206  */
207 HWTEST_F(InnerModelTest, inner_model_buildfrommetagraph_001, TestSize.Level1)
208 {
209     LOGE("BuildFromMetaGraph inner_model_buildfrommetagraph_001");
210     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
211     EXPECT_NE(nullptr, liteGraph);
212     m_dimInput = {3, -3};
213 
214     SetLiteGraph(liteGraph);
215 
216     ExtensionConfig extensionConfig;
217     InnerModel InnerModel;
218     EXPECT_EQ(OH_NN_INVALID_PARAMETER, InnerModel.BuildFromMetaGraph(nullptr, extensionConfig));
219 }
220 
221 /**
222  * @tc.name: inner_model_buildfrommetagraph_002
223  * @tc.desc: Verify the nntensor build failed nullptr return of the construct_nntensor_from_litegraph function
224  * @tc.type: FUNC
225  */
226 HWTEST_F(InnerModelTest, inner_model_buildfrommetagraph_002, TestSize.Level1)
227 {
228     LOGE("BuildFromMetaGraph inner_model_buildfrommetagraph_002");
229     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
230     EXPECT_NE(nullptr, liteGraph);
231     m_dimInput = {3, -3};
232 
233     SetLiteGraph(liteGraph);
234 
235     ExtensionConfig extensionConfig;
236     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.BuildFromMetaGraph(liteGraph, extensionConfig));
237 }
238 
239 /**
240  * @tc.name: inner_model_buildfrommetagraph_003
241  * @tc.desc: Verify the nntensor build failed nullptr return of the construct_nntensor_from_litegraph function
242  * @tc.type: FUNC
243  */
244 HWTEST_F(InnerModelTest, inner_model_buildfrommetagraph_003, TestSize.Level1)
245 {
246     LOGE("BuildFromMetaGraph inner_model_buildfrommetagraph_003");
247     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
248     EXPECT_NE(nullptr, liteGraph);
249     m_dimInput = {3, -3};
250 
251     SetLiteGraph(liteGraph);
252 
253     ExtensionConfig extensionConfig;
254     InnerModel InnerModel;
255     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.BuildFromMetaGraph(liteGraph, extensionConfig));
256 }
257 
258 /**
259  * @tc.name: inner_model_build_from_lite_graph_001
260  * @tc.desc: Verify the litegraph is nullptr of the build_from_lite_graph function
261  * @tc.type: FUNC
262  */
263 HWTEST_F(InnerModelTest, inner_model_build_from_lite_graph_001, TestSize.Level1)
264 {
265     char d = 'a';
266     char * cr = &d;
267     struct OH_NN_Extension on_exit = {
268         "zhou", cr, 5
269     };
270     OH_NN_Extension *extensions = &on_exit;
271     size_t extensionSize = 1;
272 
273     ExtensionConfig extensionConfig;
274     std::string opLayout;
275     for (size_t i = 0; i < extensionSize; ++i) {
276         std::string name = extensions[i].name;
277         if (name == "QuantBuffer") {
278             extensionConfig.quantBuffer.data = extensions[i].value;
279             extensionConfig.quantBuffer.length = extensions[i].valueSize;
280         } else if (name == "ModelName") {
281             extensionConfig.modelName.assign(extensions[i].value, extensions[i].value + extensions[i].valueSize);
282         } else if (name == "Profiling") {
283             extensionConfig.isProfiling.assign(extensions[i].value, extensions[i].value + extensions[i].valueSize);
284             LOGI("OH_NNModel_BuildFromLiteGraph isProfiling enable.");
285         } else if (name == "opLayout") {
286             opLayout.assign(extensions[i].value, extensions[i].value + extensions[i].valueSize);
287             extensionConfig.opLayout.insert({opLayout, "hiai::ExecuteDevice::CPU"});
288             LOGI("OH_NNModel_BuildFromLiteGraph opLayout:%{public}s.", opLayout.c_str());
289         }
290     }
291 
292     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest
293         .BuildFromLiteGraph(nullptr, extensionConfig));
294 }
295 
296 /**
297  * @tc.name: inner_model_build_from_lite_graph_002
298  * @tc.desc: Verify the buildfromlitegraph twice forbidden of the build_from_lite_graph function
299  * @tc.type: FUNC
300  */
301 HWTEST_F(InnerModelTest, inner_model_build_from_lite_graph_002, TestSize.Level1)
302 {
303     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
304     EXPECT_NE(nullptr, liteGraph);
305 
306     SetLiteGraph(liteGraph);
307 
308     ExtensionConfig extensionConfig;
309 
310     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.BuildFromLiteGraph(liteGraph, extensionConfig));
311     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest
312         .BuildFromLiteGraph(liteGraph, extensionConfig));
313 }
314 
315 /**
316  * @tc.name: inner_model_build_from_lite_graph_003
317  * @tc.desc: Verify the litegraph->alltensors is empty of the build_from_lite_graph function
318  * @tc.type: FUNC
319  */
320 HWTEST_F(InnerModelTest, inner_model_build_from_lite_graph_003, TestSize.Level1)
321 {
322     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
323     EXPECT_NE(nullptr, liteGraph);
324     liteGraph->name_ = "testGraph";
325     liteGraph->input_indices_ = {0};
326     liteGraph->output_indices_ = {1};
327 
328     const int32_t dimInput[2] = {2, 2};
329     const OH_NN_Tensor& tensor = {OH_NN_INT8, 2, dimInput, nullptr, OH_NN_TENSOR};
330     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
331 
332     ExtensionConfig extensionConfig;
333 
334     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest
335         .BuildFromLiteGraph(liteGraph, extensionConfig));
336 }
337 
338 
339 /**
340  * @tc.name: inner_model_add_tensor_001
341  * @tc.desc: Verify the success of the addtensor function
342  * @tc.type: FUNC
343  */
344 HWTEST_F(InnerModelTest, inner_model_add_tensor_001, TestSize.Level1)
345 {
346     const int32_t dimInput[2] = {2, 2};
347     const OH_NN_Tensor& tensor = {OH_NN_INT8, 2, dimInput, nullptr, OH_NN_TENSOR};
348     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
349 }
350 
351 /**
352  * @tc.name: inner_model_add_tensor_002
353  * @tc.desc: Verify the addtensor after buildfromlitegraph of the addtensor function
354  * @tc.type: FUNC
355  */
356 HWTEST_F(InnerModelTest, inner_model_add_tensor_002, TestSize.Level1)
357 {
358     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
359     EXPECT_NE(nullptr, liteGraph);
360     SetLiteGraph(liteGraph);
361 
362     ExtensionConfig extensionConfig;
363 
364     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.BuildFromLiteGraph(liteGraph, extensionConfig));
365 
366     const int32_t dimInput[2] = {2, 2};
367     const OH_NN_Tensor& tensor = {OH_NN_INT8, 2, dimInput, nullptr, OH_NN_TENSOR};
368     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.AddTensor(tensor));
369 }
370 
371 /**
372  * @tc.name: inner_model_add_tensor_003
373  * @tc.desc: Verify the buildfromnntensor failed of the addtensor function
374  * @tc.type: FUNC
375  */
376 HWTEST_F(InnerModelTest, inner_model_add_tensor_003, TestSize.Level1)
377 {
378     const int32_t dimInput[2] = {2, -2};
379     const OH_NN_Tensor& tensor = {OH_NN_INT8, 2, dimInput, nullptr, OH_NN_TENSOR};
380     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddTensor(tensor));
381 }
382 
383 
384 /**
385  * @tc.name: inner_model_set_tensor_value_001
386  * @tc.desc: Verify the success of the set_tensor_value function
387  * @tc.type: FUNC
388  */
389 HWTEST_F(InnerModelTest, inner_model_set_tensor_value_001, TestSize.Level1)
390 {
391     SetTensors();
392 
393     uint32_t index = 3;
394     const int8_t activation = 0;
395     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
396        static_cast<const void *>(&activation), sizeof(int8_t)));
397 }
398 
399 /**
400  * @tc.name: inner_model_set_tensor_value_002
401  * @tc.desc: Verify the index out of bounds of the set_tensor_value function
402  * @tc.type: FUNC
403  */
404 HWTEST_F(InnerModelTest, inner_model_set_tensor_value_002, TestSize.Level1)
405 {
406     SetTensors();
407 
408     uint32_t index = 6;
409     const int8_t activation = 0;
410     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.SetTensorValue(index,
411        static_cast<const void *>(&activation), sizeof(int8_t)));
412 }
413 
414 /**
415  * @tc.name: inner_model_set_tensor_value_003
416  * @tc.desc: Verify the buffer value is nullptr of the set_tensor_value function
417  * @tc.type: FUNC
418  */
419 HWTEST_F(InnerModelTest, inner_model_set_tensor_value_003, TestSize.Level1)
420 {
421     SetTensors();
422 
423     uint32_t index = 3;
424     const int8_t activation = 0;
425     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
426        nullptr, sizeof(activation)));
427 }
428 
429 /**
430  * @tc.name: inner_model_set_tensor_value_004
431  * @tc.desc: Verify the length invalid of the set_tensor_value function
432  * @tc.type: FUNC
433  */
434 HWTEST_F(InnerModelTest, inner_model_set_tensor_value_004, TestSize.Level1)
435 {
436     SetTensors();
437 
438     uint32_t index = 3;
439     const int8_t activation = 0;
440     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.SetTensorValue(index,
441        static_cast<const void *>(&activation), 0));
442 }
443 
444 /**
445  * @tc.name: inner_model_set_tensor_value_005
446  * @tc.desc: Verify the after buildgraph of the set_tensor_value function
447  * @tc.type: FUNC
448  */
449 HWTEST_F(InnerModelTest, inner_model_set_tensor_value_005, TestSize.Level1)
450 {
451     uint32_t index = 3;
452     const int8_t activation = 0;
453 
454     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
455     EXPECT_NE(nullptr, liteGraph);
456     SetLiteGraph(liteGraph);
457 
458     ExtensionConfig extensionConfig;
459 
460     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.BuildFromLiteGraph(liteGraph, extensionConfig));
461 
462     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.SetTensorValue(index,
463        static_cast<const void *>(&activation), sizeof(int8_t)));
464 }
465 
466 /**
467  * @tc.name: inner_model_set_tensor_value_006
468  * @tc.desc: Verify the set value twice of the set_tensor_value function
469  * @tc.type: FUNC
470  */
471 HWTEST_F(InnerModelTest, inner_model_set_tensor_value_006, TestSize.Level1)
472 {
473     SetTensors();
474 
475     uint32_t index = 3;
476     const int8_t activation = 0;
477     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
478        static_cast<const void *>(&activation), sizeof(int8_t)));
479 
480     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.SetTensorValue(index,
481        static_cast<const void *>(&activation), sizeof(int8_t)));
482 }
483 
484 /**
485  * @tc.name: inner_model_set_tensor_value_007
486  * @tc.desc: Verify the tensor dynamicShape of the set_tensor_value function
487  * @tc.type: FUNC
488  */
489 HWTEST_F(InnerModelTest, inner_model_set_tensor_value_007, TestSize.Level1)
490 {
491     const int32_t dimInput[2] = {2, -1};
492     const OH_NN_Tensor& tensor = {OH_NN_FLOAT32, 2, dimInput, nullptr, OH_NN_TENSOR};
493 
494     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
495     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
496     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
497     const OH_NN_Tensor& tensorParam = {OH_NN_INT8, 0, nullptr, nullptr, OH_NN_ADD_ACTIVATIONTYPE};
498     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensorParam));
499 
500     uint32_t index = 0;
501     float x[4] = {0, 1, 2, 3};
502     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.SetTensorValue(index,
503        x, sizeof(x)- 1));
504 }
505 
506 /**
507  * @tc.name: inner_model_add_operation_001
508  * @tc.desc: Verify the success of the addoperation function
509  * @tc.type: FUNC
510  */
511 HWTEST_F(InnerModelTest, inner_model_add_operation_001, TestSize.Level1)
512 {
513     SetIndices();
514 
515     SetTensors();
516 
517     uint32_t index = 3;
518     const int8_t activation = 0;
519     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
520        static_cast<const void *>(&activation), sizeof(int8_t)));
521 
522     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
523 }
524 
525 /**
526  * @tc.name: inner_model_add_operation_002
527  * @tc.desc: Verify the after buildgraph of the addtensor function
528  * @tc.type: FUNC
529  */
530 HWTEST_F(InnerModelTest, inner_model_add_operation_002, TestSize.Level1)
531 {
532     OH_NN_OperationType m_opType = OH_NN_OPS_ADD;
533     OH_NN_UInt32Array m_inputs;
534     OH_NN_UInt32Array m_outputs;
535     OH_NN_UInt32Array m_params;
536 
537     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
538     EXPECT_NE(nullptr, liteGraph);
539     SetLiteGraph(liteGraph);
540 
541     ExtensionConfig extensionConfig;
542 
543     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.BuildFromLiteGraph(liteGraph, extensionConfig));
544 
545     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs,
546         m_outputs));
547 }
548 
549 /**
550  * @tc.name: inner_model_add_operation_003
551  * @tc.desc: Verify the without set buffer of the addtensor function
552  * @tc.type: FUNC
553  */
554 HWTEST_F(InnerModelTest, inner_model_add_operation_003, TestSize.Level1)
555 {
556     SetIndices();
557     SetTensors();
558 
559     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
560 }
561 
562 /**
563  * @tc.name: inner_model_add_operation_004
564  * @tc.desc: Verify the output indices equal to input indices  of the addtensor function
565  * @tc.type: FUNC
566  */
567 HWTEST_F(InnerModelTest, inner_model_add_operation_004, TestSize.Level1)
568 {
569     m_outputIndexs[0] = 0;
570 
571     SetIndices();
572     SetTensors();
573 
574     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
575 }
576 
577 /**
578  * @tc.name: inner_model_add_operation_005
579  * @tc.desc: Verify the optype invalid of the addtensor function
580  * @tc.type: FUNC
581  */
582 HWTEST_F(InnerModelTest, inner_model_add_operation_005, TestSize.Level1)
583 {
584     m_opType = OH_NN_OperationType(99);
585 
586     SetIndices();
587     SetTensors();
588 
589     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
590 }
591 
592 /**
593  * @tc.name: inner_model_add_operation_006
594  * @tc.desc: Verify the input indices out of bounds of the addoperation function
595  * @tc.type: FUNC
596  */
597 HWTEST_F(InnerModelTest, inner_model_add_operation_006, TestSize.Level1)
598 {
599     m_inputIndexs[1] = 6;
600 
601     SetIndices();
602     SetTensors();
603 
604     uint32_t index = 3;
605     const int8_t activation = 0;
606     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
607        static_cast<const void *>(&activation), sizeof(int8_t)));
608     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
609 }
610 
611 /**
612  * @tc.name: inner_model_add_operation_007
613  * @tc.desc: Verify the param indices out of bounds of the addoperation function
614  * @tc.type: FUNC
615  */
616 HWTEST_F(InnerModelTest, inner_model_add_operation_007, TestSize.Level1)
617 {
618     m_paramIndexs[0] = 6;
619 
620     SetIndices();
621     SetTensors();
622 
623     uint32_t index = 3;
624     const int8_t activation = 0;
625     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
626        static_cast<const void *>(&activation), sizeof(int8_t)));
627     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
628 }
629 
630 /**
631  * @tc.name: inner_model_add_operation_008
632  * @tc.desc: Verify the input indices size is 0 of the addoperation function
633  * @tc.type: FUNC
634  */
635 HWTEST_F(InnerModelTest, inner_model_add_operation_008, TestSize.Level1)
636 {
637     SetIndices();
638 
639     m_inputs.size = 0;
640     m_inputs.data = nullptr;
641     SetTensors();
642 
643     uint32_t index = 3;
644     const int8_t activation = 0;
645     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
646        static_cast<const void *>(&activation), sizeof(int8_t)));
647 
648     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
649 }
650 
651 /**
652  * @tc.name: inner_model_add_operation_009
653  * @tc.desc: Verify the output indices size is 0 of the addoperation function
654  * @tc.type: FUNC
655  */
656 HWTEST_F(InnerModelTest, inner_model_add_operation_009, TestSize.Level1)
657 {
658     SetIndices();
659 
660     m_outputs.size = 0;
661     m_outputs.data = nullptr;
662     SetTensors();
663 
664     uint32_t index = 3;
665     const int8_t activation = 0;
666     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
667        static_cast<const void *>(&activation), sizeof(int8_t)));
668 
669     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
670 }
671 
672 /**
673  * @tc.name: inner_model_add_operation_010
674  * @tc.desc: Verify the ops build failed of the addoperation function
675  * @tc.type: FUNC
676  */
677 HWTEST_F(InnerModelTest, inner_model_add_operation_010, TestSize.Level1)
678 {
679     SetIndices();
680 
681     const int32_t dimInput1[2] = {2, 2};
682     const OH_NN_Tensor& tensor = {OH_NN_FLOAT32, 2, dimInput1, nullptr, OH_NN_TENSOR};
683     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
684     const int32_t dimInput2[2] = {2, 2};
685     const OH_NN_Tensor& tensor1 = {OH_NN_FLOAT32, 2, dimInput2, nullptr, OH_NN_TENSOR};
686     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor1));
687     const int32_t dimOutput[2] = {2, 2};
688     const OH_NN_Tensor& tensor2 = {OH_NN_FLOAT32, 2, dimOutput, nullptr, OH_NN_TENSOR};
689     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor2));
690     const OH_NN_Tensor& tensor3 = {OH_NN_INT8, 0, nullptr, nullptr, OH_NN_DIV_ACTIVATIONTYPE};
691     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor3));
692 
693     uint32_t index = 3;
694     const int8_t activation = 0;
695     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
696        static_cast<const void *>(&activation), sizeof(int8_t)));
697 
698     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
699 }
700 
701 /**
702  * @tc.name: inner_model_specify_inputs_and_outputs_001
703  * @tc.desc: Verify the success of the specify_inputs_and_outputs function
704  * @tc.type: FUNC
705  */
706 HWTEST_F(InnerModelTest, inner_model_specify_inputs_and_outputs_001, TestSize.Level1)
707 {
708     SetIndices();
709     SetTensors();
710 
711     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
712 
713     std::vector<std::shared_ptr<NNTensor>> inTensors = m_innerModelTest.GetInputTensors();
714     EXPECT_EQ(inTensors.size(), m_inputs.size);
715     std::vector<std::shared_ptr<NNTensor>> outTensors = m_innerModelTest.GetOutputTensors();
716     EXPECT_EQ(outTensors.size(), m_outputs.size);
717 }
718 
719 /**
720  * @tc.name: inner_model_specify_inputs_and_outputs_002
721  * @tc.desc: Verify the after buildgraph of the specify_inputs_and_outputs function
722  * @tc.type: FUNC
723  */
724 HWTEST_F(InnerModelTest, inner_model_specify_inputs_and_outputs_002, TestSize.Level1)
725 {
726     OH_NN_UInt32Array inputs;
727     OH_NN_UInt32Array outputs;
728     inputs.data = m_inputIndexs;
729     inputs.size = sizeof(m_inputIndexs) / sizeof(uint32_t);
730     outputs.data = nullptr;
731     outputs.size = sizeof(m_outputIndexs) / sizeof(uint32_t);
732 
733     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
734     EXPECT_NE(nullptr, liteGraph);
735     SetLiteGraph(liteGraph);
736 
737     ExtensionConfig extensionConfig;
738 
739     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.BuildFromLiteGraph(liteGraph, extensionConfig));
740 
741     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.SpecifyInputsAndOutputs(inputs, outputs));
742 }
743 
744 /**
745  * @tc.name: inner_model_specify_inputs_and_outputs_003
746  * @tc.desc: Verify the output indices is nullptr but length not 0 of the specify_inputs_and_outputs function
747  * @tc.type: FUNC
748  */
749 HWTEST_F(InnerModelTest, inner_model_specify_inputs_and_outputs_003, TestSize.Level1)
750 {
751     SetIndices();
752 
753     m_outputs.data = nullptr;
754     SetTensors();
755 
756     EXPECT_EQ(OH_NN_INVALID_PARAMETER, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
757 }
758 
759 /**
760  * @tc.name: inner_model_specify_inputs_and_outputs_004
761  * @tc.desc: Verify the specift twice of the specify_inputs_and_outputs function
762  * @tc.type: FUNC
763  */
764 HWTEST_F(InnerModelTest, inner_model_specify_inputs_and_outputs_004, TestSize.Level1)
765 {
766     SetIndices();
767     SetTensors();
768 
769     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
770 
771     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
772 }
773 
774 /**
775  * @tc.name: inner_model_build_001
776  * @tc.desc: Verify the success of the build function
777  * @tc.type: FUNC
778  */
779 HWTEST_F(InnerModelTest, inner_model_build_001, TestSize.Level1)
780 {
781     SetIndices();
782     SetTensors();
783 
784     uint32_t index = 3;
785     const int8_t activation = 0;
786     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
787        static_cast<const void *>(&activation), sizeof(int8_t)));
788 
789     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
790     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
791     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.Build());
792     EXPECT_EQ(true, m_innerModelTest.IsBuild());
793 }
794 
795 /**
796  * @tc.name: inner_model_build_002
797  * @tc.desc: Verify the build twice forbidden of the build function
798  * @tc.type: FUNC
799  */
800 HWTEST_F(InnerModelTest, inner_model_build_002, TestSize.Level1)
801 {
802     SetIndices();
803     SetTensors();
804 
805     uint32_t index = 3;
806     const int8_t activation = 0;
807     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
808        static_cast<const void *>(&activation), sizeof(int8_t)));
809 
810     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
811     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
812     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.Build());
813     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.Build());
814 }
815 
816 /**
817  * @tc.name: inner_model_build_003
818  * @tc.desc: Verify the params not match optype of the build function
819  * @tc.type: FUNC
820  */
821 HWTEST_F(InnerModelTest, inner_model_build_003, TestSize.Level1)
822 {
823     OH_NN_OperationType m_opType = OH_NN_OPS_DIV;
824 
825     SetIndices();
826 
827     const int dim[2] = {2, 2};
828     const OH_NN_Tensor& tensor = {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR};
829     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
830     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
831     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensor));
832     const OH_NN_Tensor& tensorParam = {OH_NN_INT8, 0, nullptr, nullptr, OH_NN_DIV_ACTIVATIONTYPE};
833     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddTensor(tensorParam));
834 
835     uint32_t index = 3;
836     const int8_t activation = 0;
837     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
838        static_cast<const void *>(&activation), sizeof(int8_t)));
839     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
840     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
841     EXPECT_EQ(OH_NN_FAILED, m_innerModelTest.Build());
842 }
843 
844 /**
845  * @tc.name: inner_model_build_004
846  * @tc.desc: Verify the success of the build function
847  * @tc.type: FUNC
848  */
849 HWTEST_F(InnerModelTest, inner_model_build_004, TestSize.Level1)
850 {
851     SetIndices();
852     SetTensors();
853 
854     uint32_t index = 3;
855     const int8_t activation = 0;
856     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
857        static_cast<const void *>(&activation), sizeof(int8_t)));
858 
859     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
860     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
861     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.Build());
862 }
863 
864 /**
865  * @tc.name: inner_model_get_supported_operation_001
866  * @tc.desc: Verify the success of the get_supported_operation function
867  * @tc.type: FUNC
868  */
869 HWTEST_F(InnerModelTest, inner_model_get_supported_operation_001, TestSize.Level1)
870 {
871     const bool *isSupported = nullptr;
872     uint32_t opCount = 1;
873 
874     SetIndices();
875     SetTensors();
876 
877     uint32_t index = 3;
878     const int8_t activation = 0;
879     size_t deviceID = 10;
880     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
881        static_cast<const void *>(&activation), sizeof(int8_t)));
882 
883     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
884     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
885     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.Build());
886     EXPECT_EQ(OH_NN_FAILED, m_innerModelTest.GetSupportedOperations(deviceID, &isSupported, opCount));
887 }
888 
889 /**
890  * @tc.name: inner_model_get_supported_operation_002
891  * @tc.desc: Verify the mock hdi device result of the get_supported_operation function
892  * @tc.type: FUNC
893  */
894 HWTEST_F(InnerModelTest, inner_model_get_supported_operation_002, TestSize.Level1)
895 {
896     size_t deviceID = 10;
897     const bool *isSupported = nullptr;
898     uint32_t opCount = 1;
899 
900     mindspore::lite::LiteGraph* liteGraph = new (std::nothrow) mindspore::lite::LiteGraph();
901     EXPECT_NE(nullptr, liteGraph);
902     SetLiteGraph(liteGraph);
903 
904     ExtensionConfig extensionConfig;
905 
906     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.BuildFromLiteGraph(liteGraph, extensionConfig));
907 
908     EXPECT_EQ(OH_NN_FAILED, m_innerModelTest.GetSupportedOperations(deviceID, &isSupported, opCount));
909 }
910 
911 /**
912  * @tc.name: inner_model_get_supported_operation_003
913  * @tc.desc: Verify the mock device manager of the get_supported_operation function
914  * @tc.type: FUNC
915  */
916 HWTEST_F(InnerModelTest, inner_model_get_supported_operation_003, TestSize.Level1)
917 {
918     const bool *isSupported = nullptr;
919     uint32_t opCount = 1;
920 
921     SetIndices();
922     SetTensors();
923 
924     uint32_t index = 3;
925     const int8_t activation = 0;
926     size_t deviceID = 12345;
927     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SetTensorValue(index,
928        static_cast<const void *>(&activation), sizeof(int8_t)));
929 
930     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.AddOperation(m_opType, m_params, m_inputs, m_outputs));
931     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.SpecifyInputsAndOutputs(m_inputs, m_outputs));
932     EXPECT_EQ(OH_NN_SUCCESS, m_innerModelTest.Build());
933     EXPECT_EQ(OH_NN_FAILED, m_innerModelTest.GetSupportedOperations(deviceID, &isSupported, opCount));
934 
935     std::shared_ptr<mindspore::lite::LiteGraph> liteGraph = m_innerModelTest.GetLiteGraphs();
936     EXPECT_EQ(liteGraph->name_, "NNR_Model");
937 }
938 
939 /**
940  * @tc.name: inner_model_get_supported_operation_004
941  * @tc.desc: Verify the before build of the get_supported_operation function
942  * @tc.type: FUNC
943  */
944 HWTEST_F(InnerModelTest, inner_model_get_supported_operation_004, TestSize.Level1)
945 {
946     size_t deviceID = 10;
947     const bool *isSupported = nullptr;
948     uint32_t opCount = 1;
949 
950     EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, m_innerModelTest.GetSupportedOperations(deviceID, &isSupported, opCount));
951 }
952 } // namespace UnitTest
953 } // namespace NNRT
954 
955 namespace OHOS {
956 namespace NeuralNetworkRuntime {
957 namespace NNRt_V2_1 {
958 namespace UnitTest {
959 class LiteGraphToHDIModelTest : public testing::Test {
960 public:
961     LiteGraphToHDIModelTest() = default;
962     ~LiteGraphToHDIModelTest() = default;
963 public:
964     std::vector<uint32_t> m_inputs{0, 1};
965     std::vector<uint32_t> m_outputs{2};
966     std::vector<uint32_t> m_param{3};
967     std::vector<int32_t> m_input_dim{3, 3};
968     std::vector<int32_t> m_output_dim{3, 3};
969     std::vector<int32_t> m_param_dim{};
970 };
971 
getNode(void * primitive)972 MSLITE::LiteGraph::Node* getNode(void* primitive)
973 {
974     MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
975     node->name_ = "NNRt_SubGraph";
976     node->quant_type_ = 1;
977     node->primitive_ = primitive;
978     node->input_indices_ = {1, 1, 1, 1};
979     node->output_indices_ = {1, 1, 1, 1};
980     return node;
981 }
982 
983 /**
984  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_001
985  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
986  * @tc.type: FUNC
987  */
988 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_001, TestSize.Level0)
989 {
990     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_001");
991     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
992     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(nullptr, tensorBuffer);
993     EXPECT_EQ(nullptr, model);
994 }
995 
996 /**
997  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_002
998  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
999  * @tc.type: FUNC
1000  */
1001 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_002, TestSize.Level0)
1002 {
1003     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_002");
1004     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1005     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {0, 0, 0, 0};
1006     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1007     EXPECT_EQ(nullptr, model);
1008 
1009     uint8_t *mmapPtr = static_cast<uint8_t *>(mmap(nullptr,
1010         tensorBuffer.bufferSize, PROT_READ | PROT_WRITE, MAP_SHARED, tensorBuffer.fd, 0));
1011     EXPECT_EQ(MAP_FAILED, mmapPtr);
1012 }
1013 
1014 /**
1015  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_003
1016  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1017  * @tc.type: FUNC
1018  */
1019 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_003, TestSize.Level0)
1020 {
1021     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_003");
1022     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1023     MSLITE::LiteGraph::SubGraph* subGraph = new (std::nothrow) MSLITE::LiteGraph::SubGraph();
1024     subGraph->name_ = "NNRt_SubGraph";
1025     subGraph->input_indices_ = {1, 1, 1, 1};
1026     subGraph->output_indices_ = {1, 1, 1, 1};
1027     subGraph->node_indices_ = {1, 1, 1, 1};
1028 
1029     void* tp = MSLITE::MindIR_Tensor_Create();
1030 
1031     liteGraph.get()->all_tensors_.emplace_back(tp);
1032     liteGraph.get()->sub_graphs_.emplace_back(subGraph);
1033 
1034     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 1, 1, 1};
1035 
1036     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1037     EXPECT_NE(nullptr, model);
1038 
1039     uint8_t *mmapPtr = static_cast<uint8_t *>(mmap(nullptr,
1040         tensorBuffer.bufferSize, PROT_READ | PROT_WRITE, MAP_SHARED, tensorBuffer.fd, 0));
1041     EXPECT_EQ(MAP_FAILED, mmapPtr);
1042 }
1043 
1044 /**
1045  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_004
1046  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1047  * @tc.type: FUNC
1048  */
1049 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_004, TestSize.Level0)
1050 {
1051     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_004");
1052     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1053     liteGraph.get()->all_nodes_.emplace_back(nullptr);
1054     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1055     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1056     EXPECT_EQ(nullptr, model);
1057 }
1058 
1059 /**
1060  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_005
1061  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1062  * @tc.type: FUNC
1063  */
1064 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_005, TestSize.Level0)
1065 {
1066     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_005");
1067     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1068     MSLITE::LiteGraph::Node* node = new(std::nothrow) MSLITE::LiteGraph::Node();
1069     liteGraph.get()->all_nodes_.emplace_back(node);
1070     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1071     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1072     EXPECT_EQ(nullptr, model);
1073 }
1074 
1075 /**
1076  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_006
1077  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1078  * @tc.type: FUNC
1079  */
1080 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_006, TestSize.Level0)
1081 {
1082     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_006");
1083     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1084 
1085     float alpha {0.0f};
1086     float minVal {0.0f};
1087     float maxVal {0.0f};
1088     bool approximate {false};
1089     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_ABS};
1090 
1091     void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType, alpha,
1092         minVal, maxVal, approximate);
1093 
1094     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1095     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1096     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1097     EXPECT_NE(nullptr, model);
1098 }
1099 
1100 /**
1101  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_007
1102  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1103  * @tc.type: FUNC
1104  */
1105 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_007, TestSize.Level0)
1106 {
1107     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_007");
1108     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1109 
1110     int8_t num = 1;
1111     int8_t* fuseData = &num;
1112     mindspore::lite::ActivationType type = NNToMS::TransfromFusionType(static_cast<OH_NN_FuseType>(*fuseData));
1113     void* primitive = mindspore::lite::MindIR_AddFusion_CreatePrimitive(type);
1114 
1115     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1116     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1117     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1118     EXPECT_NE(nullptr, model);
1119 }
1120 
1121 /**
1122  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_008
1123  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1124  * @tc.type: FUNC
1125  */
1126 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_008, TestSize.Level0)
1127 {
1128     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_008");
1129     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1130 
1131     int64_t keepDims {0};
1132     void* primitive = mindspore::lite::MindIR_All_CreatePrimitive(keepDims);
1133 
1134     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1135     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1136     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1137     EXPECT_NE(nullptr, model);
1138 }
1139 
1140 /**
1141  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_009
1142  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1143  * @tc.type: FUNC
1144  */
1145 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_009, TestSize.Level0)
1146 {
1147     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_009");
1148     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1149 
1150     int64_t axis {-1};
1151     int64_t topK {1};
1152     bool keepDims {false};
1153     bool outMaxValue {false};
1154     void* primitive = mindspore::lite::MindIR_ArgMaxFusion_CreatePrimitive(axis, topK, keepDims, outMaxValue);
1155 
1156     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1157     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1158     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1159     EXPECT_NE(nullptr, model);
1160 }
1161 
1162 /**
1163  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_010
1164  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1165  * @tc.type: FUNC
1166  */
1167 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_010, TestSize.Level0)
1168 {
1169     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_010");
1170     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1171 
1172     int64_t summarize {0};
1173     void* primitive = mindspore::lite::MindIR_Assert_CreatePrimitive(summarize);
1174 
1175     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1176     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1177     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1178     EXPECT_NE(nullptr, model);
1179 }
1180 
1181 /**
1182  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_011
1183  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1184  * @tc.type: FUNC
1185  */
1186 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_011, TestSize.Level0)
1187 {
1188     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_011");
1189     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1190 
1191     std::vector<int64_t> kernelSize;
1192     std::vector<int64_t> pad;
1193     std::vector<int64_t> strides;
1194     mindspore::lite::PadMode padMode {mindspore::lite::PAD_MODE_PAD};
1195     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
1196     mindspore::lite::RoundMode roundMode {mindspore::lite::ROUND_MODE_FLOOR};
1197     mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
1198     bool global {false};
1199     void* primitive = mindspore::lite::MindIR_AvgPoolFusion_CreatePrimitive(kernelSize, strides, pad,
1200         padMode, roundMode, format, global, activationType);
1201 
1202     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1203     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1204     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1205     EXPECT_NE(nullptr, model);
1206 }
1207 
1208 /**
1209  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_012
1210  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1211  * @tc.type: FUNC
1212  */
1213 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_012, TestSize.Level0)
1214 {
1215     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_012");
1216     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1217 
1218     std::vector<int64_t> blockSize;
1219     std::vector<std::vector<int64_t>> crops;
1220     void* primitive = mindspore::lite::MindIR_BatchToSpaceND_CreatePrimitive(blockSize, crops);
1221 
1222     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1223     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1224     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1225     EXPECT_NE(nullptr, model);
1226 }
1227 
1228 /**
1229  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_013
1230  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1231  * @tc.type: FUNC
1232  */
1233 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_013, TestSize.Level0)
1234 {
1235     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_013");
1236     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1237 
1238     float epsilon {0.0001f};
1239     void* primitive = mindspore::lite::MindIR_FusedBatchNorm_CreatePrimitive(epsilon);
1240 
1241     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1242     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1243     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1244     EXPECT_NE(nullptr, model);
1245 }
1246 
1247 /**
1248  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_014
1249  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1250  * @tc.type: FUNC
1251  */
1252 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_014, TestSize.Level0)
1253 {
1254     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_014");
1255     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1256 
1257     float epsilon {0.0001f};
1258     void* primitive = mindspore::lite::MindIR_FusedBatchNorm_CreatePrimitive(epsilon);
1259 
1260     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1261     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1262     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1263     EXPECT_NE(nullptr, model);
1264 }
1265 
1266 /**
1267  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_015
1268  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1269  * @tc.type: FUNC
1270  */
1271 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_015, TestSize.Level0)
1272 {
1273     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_015");
1274     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1275 
1276     void* primitive = mindspore::lite::MindIR_BiasAdd_CreatePrimitive();
1277 
1278     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1279     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1280     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1281     EXPECT_NE(nullptr, model);
1282 }
1283 
1284 /**
1285  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_016
1286  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1287  * @tc.type: FUNC
1288  */
1289 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_016, TestSize.Level0)
1290 {
1291     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_016");
1292     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1293 
1294     std::vector<int64_t> shape;
1295     void* primitive = mindspore::lite::MindIR_BroadcastTo_CreatePrimitive(shape);
1296 
1297     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1298     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1299     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1300     EXPECT_NE(nullptr, model);
1301 }
1302 
1303 /**
1304  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_017
1305  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1306  * @tc.type: FUNC
1307  */
1308 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_017, TestSize.Level0)
1309 {
1310     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_017");
1311     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1312 
1313     void* primitive = mindspore::lite::MindIR_Cast_CreatePrimitive();
1314 
1315     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1316     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1317     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1318     EXPECT_NE(nullptr, model);
1319 }
1320 
1321 /**
1322  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_018
1323  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1324  * @tc.type: FUNC
1325  */
1326 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_018, TestSize.Level0)
1327 {
1328     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_018");
1329     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1330 
1331     void* primitive = mindspore::lite::MindIR_Ceil_CreatePrimitive();
1332 
1333     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1334     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1335     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1336     EXPECT_NE(nullptr, model);
1337 }
1338 
1339 /**
1340  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_019
1341  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1342  * @tc.type: FUNC
1343  */
1344 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_019, TestSize.Level0)
1345 {
1346     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_019");
1347     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1348 
1349     float max {0.0f};
1350     float min {0.0f};
1351     void* primitive = mindspore::lite::MindIR_Clip_CreatePrimitive(max, min);
1352 
1353     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1354     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1355     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1356     EXPECT_NE(nullptr, model);
1357 }
1358 
1359 /**
1360  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_020
1361  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1362  * @tc.type: FUNC
1363  */
1364 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_020, TestSize.Level0)
1365 {
1366     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_020");
1367     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1368 
1369     int64_t axis{0};
1370     void* primitive = mindspore::lite::MindIR_Concat_CreatePrimitive(axis);
1371 
1372     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1373     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1374     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1375     EXPECT_NE(nullptr, model);
1376 }
1377 
1378 /**
1379  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_021
1380  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1381  * @tc.type: FUNC
1382  */
1383 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_021, TestSize.Level0)
1384 {
1385     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_021");
1386     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1387 
1388     int64_t dataType {0};
1389     std::vector<float> value;
1390     void* primitive = mindspore::lite::MindIR_ConstantOfShape_CreatePrimitive(dataType, value);
1391 
1392     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1393     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1394     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1395     EXPECT_NE(nullptr, model);
1396 }
1397 
1398 /**
1399  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_022
1400  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1401  * @tc.type: FUNC
1402  */
1403 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_022, TestSize.Level0)
1404 {
1405     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_022");
1406     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1407 
1408     int64_t group {1};
1409     int64_t inChannel {0};
1410     int64_t outChannel {0};
1411     std::vector<int64_t> kernelSize;
1412     std::vector<int64_t> strides;
1413     std::vector<int64_t> padList;
1414     std::vector<int64_t> dilation;
1415     std::vector<int64_t> outputPaddings;
1416     mindspore::lite::PadMode padMode{mindspore::lite::PAD_MODE_PAD};
1417     mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
1418     void* primitive = MindIR_Conv2dTransposeFusion_CreatePrimitive(kernelSize,
1419         strides, dilation, padMode, padList, group, inChannel, outChannel,
1420         activationType, outputPaddings);
1421 
1422     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1423     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1424     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1425     EXPECT_NE(nullptr, model);
1426 }
1427 
1428 /**
1429  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_023
1430  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1431  * @tc.type: FUNC
1432  */
1433 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_023, TestSize.Level0)
1434 {
1435     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_023");
1436     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1437 
1438     void* primitive = mindspore::lite::MindIR_Cos_CreatePrimitive();
1439 
1440     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1441     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1442     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1443     EXPECT_NE(nullptr, model);
1444 }
1445 
1446 /**
1447  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_024
1448  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1449  * @tc.type: FUNC
1450  */
1451 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_024, TestSize.Level0)
1452 {
1453     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_024");
1454     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1455 
1456     int64_t axis {0};
1457     std::vector<int64_t> offset;
1458     void* primitive = mindspore::lite::MindIR_Crop_CreatePrimitive(axis, offset);
1459 
1460     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1461     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1462     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1463     EXPECT_NE(nullptr, model);
1464 }
1465 
1466 /**
1467  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_025
1468  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1469  * @tc.type: FUNC
1470  */
1471 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_025, TestSize.Level0)
1472 {
1473     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_025");
1474     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1475 
1476     int64_t blockSize {0};
1477     std::string mode;
1478     mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
1479     void* primitive = mindspore::lite::MindIR_DepthToSpace_CreatePrimitive(blockSize, format, mode);
1480 
1481     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1482     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1483     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1484     EXPECT_NE(nullptr, model);
1485 }
1486 
1487 /**
1488  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_026
1489  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1490  * @tc.type: FUNC
1491  */
1492 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_026, TestSize.Level0)
1493 {
1494     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_026");
1495     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1496 
1497     int64_t inputSize {0};
1498     std::vector<float> scale;
1499     float nmsIoUThreshold {0.0f};
1500     float nmsScoreThreshold {0.0f};
1501     int64_t maxDetections {0};
1502     int64_t detectionsPerClass {0};
1503     int64_t maxClassesPerDetection {0};
1504     int64_t numClasses {0};
1505     bool useRegularNms {false};
1506     bool outQuantized {false};
1507     mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
1508     void* primitive = mindspore::lite::MindIR_DetectionPostProcess_CreatePrimitive(format, inputSize, scale,
1509         nmsIoUThreshold, nmsScoreThreshold, maxDetections, detectionsPerClass, maxClassesPerDetection,
1510         numClasses, useRegularNms, outQuantized);
1511 
1512     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1513     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1514     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1515     EXPECT_NE(nullptr, model);
1516 }
1517 
1518 /**
1519  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_027
1520  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1521  * @tc.type: FUNC
1522  */
1523 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_027, TestSize.Level0)
1524 {
1525     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_027");
1526     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1527 
1528     mindspore::lite::EltwiseMode mode {mindspore::lite::ELTWISE_MODE_PROD};
1529     void* primitive = mindspore::lite::MindIR_Eltwise_CreatePrimitive(mode);
1530 
1531     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1532     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1533     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1534     EXPECT_NE(nullptr, model);
1535 }
1536 
1537 /**
1538  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_028
1539  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1540  * @tc.type: FUNC
1541  */
1542 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_028, TestSize.Level0)
1543 {
1544     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_028");
1545     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1546 
1547     void* primitive = mindspore::lite::MindIR_Equal_CreatePrimitive();
1548 
1549     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1550     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1551     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1552     EXPECT_NE(nullptr, model);
1553 }
1554 
1555 /**
1556  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_029
1557  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1558  * @tc.type: FUNC
1559  */
1560 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_029, TestSize.Level0)
1561 {
1562     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_029");
1563     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1564 
1565     void* primitive = mindspore::lite::MindIR_Erf_CreatePrimitive();
1566 
1567     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1568     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1569     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1570     EXPECT_NE(nullptr, model);
1571 }
1572 
1573 /**
1574  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_030
1575  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1576  * @tc.type: FUNC
1577  */
1578 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_030, TestSize.Level0)
1579 {
1580     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_030");
1581     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1582 
1583     float base {-1.0f};
1584     float scale {1.0f};
1585     float shift {0.0f};
1586     void* primitive = mindspore::lite::MindIR_ExpFusion_CreatePrimitive(base, scale, shift);
1587 
1588     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1589     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1590     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1591     EXPECT_NE(nullptr, model);
1592 }
1593 
1594 /**
1595  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_031
1596  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1597  * @tc.type: FUNC
1598  */
1599 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_031, TestSize.Level0)
1600 {
1601     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_031");
1602     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1603 
1604     void* primitive = mindspore::lite::MindIR_ExpandDims_CreatePrimitive();
1605 
1606     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1607     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1608     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1609     EXPECT_NE(nullptr, model);
1610 }
1611 
1612 /**
1613  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_032
1614  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1615  * @tc.type: FUNC
1616  */
1617 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_032, TestSize.Level0)
1618 {
1619     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_032");
1620     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1621 
1622     void* primitive = mindspore::lite::MindIR_Fill_CreatePrimitive();
1623 
1624     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1625     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1626     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1627     EXPECT_NE(nullptr, model);
1628 }
1629 
1630 /**
1631  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_033
1632  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1633  * @tc.type: FUNC
1634  */
1635 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_033, TestSize.Level0)
1636 {
1637     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_033");
1638     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1639 
1640     int64_t axis {1};
1641     void* primitive = mindspore::lite::MindIR_Flatten_CreatePrimitive(axis);
1642 
1643     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1644     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1645     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1646     EXPECT_NE(nullptr, model);
1647 }
1648 
1649 /**
1650  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_034
1651  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1652  * @tc.type: FUNC
1653  */
1654 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_034, TestSize.Level0)
1655 {
1656     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_034");
1657     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1658 
1659     void* primitive = mindspore::lite::MindIR_Floor_CreatePrimitive();
1660 
1661     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1662     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1663     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1664     EXPECT_NE(nullptr, model);
1665 }
1666 
1667 /**
1668  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_035
1669  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1670  * @tc.type: FUNC
1671  */
1672 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_035, TestSize.Level0)
1673 {
1674     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_035");
1675     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1676 
1677     bool hasBias {false};
1678     bool useAxis {false};
1679     int64_t axis {0};
1680     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
1681     void* primitive = mindspore::lite::MindIR_FullConnection_CreatePrimitive(hasBias, useAxis,
1682         axis, activationType);
1683 
1684     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1685     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1686     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1687     EXPECT_NE(nullptr, model);
1688 }
1689 
1690 /**
1691  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_036
1692  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1693  * @tc.type: FUNC
1694  */
1695 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_036, TestSize.Level0)
1696 {
1697     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_036");
1698     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1699 
1700     void* primitive = mindspore::lite::MindIR_Gather_CreatePrimitive();
1701 
1702     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1703     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1704     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1705     EXPECT_NE(nullptr, model);
1706 }
1707 
1708 /**
1709  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_037
1710  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1711  * @tc.type: FUNC
1712  */
1713 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_037, TestSize.Level0)
1714 {
1715     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_037");
1716     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1717 
1718     void* primitive = mindspore::lite::MindIR_GatherNd_CreatePrimitive();
1719 
1720     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1721     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1722     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1723     EXPECT_NE(nullptr, model);
1724 }
1725 
1726 /**
1727  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_038
1728  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1729  * @tc.type: FUNC
1730  */
1731 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_038, TestSize.Level0)
1732 {
1733     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_038");
1734     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1735 
1736     mindspore::lite::ActivationType activationType = mindspore::lite::ACTIVATION_TYPE_GELU;
1737     float alpha = 0.0f;
1738     float minVal = 0.0f;
1739     float maxVal = 0.0f;
1740     bool approximate = false;
1741     void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType,
1742         alpha, minVal, maxVal, approximate);
1743 
1744     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1745     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1746     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1747     EXPECT_NE(nullptr, model);
1748 }
1749 
1750 /**
1751  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_039
1752  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1753  * @tc.type: FUNC
1754  */
1755 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_039, TestSize.Level0)
1756 {
1757     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_039");
1758     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1759 
1760     void* primitive = mindspore::lite::MindIR_Greater_CreatePrimitive();
1761 
1762     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1763     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1764     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1765     EXPECT_NE(nullptr, model);
1766 }
1767 
1768 /**
1769  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_040
1770  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1771  * @tc.type: FUNC
1772  */
1773 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_040, TestSize.Level0)
1774 {
1775     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_040");
1776     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1777 
1778     void* primitive = mindspore::lite::MindIR_GreaterEqual_CreatePrimitive();
1779 
1780     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1781     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1782     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1783     EXPECT_NE(nullptr, model);
1784 }
1785 
1786 /**
1787  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_041
1788  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1789  * @tc.type: FUNC
1790  */
1791 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_041, TestSize.Level0)
1792 {
1793     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_041");
1794     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1795 
1796     mindspore::lite::ActivationType activationType = mindspore::lite::ACTIVATION_TYPE_HSIGMOID;
1797     float alpha = 0.0f;
1798     float minVal = 0.0f;
1799     float maxVal = 0.0f;
1800     bool approximate = false;
1801     void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType,
1802         alpha, minVal, maxVal, approximate);
1803 
1804     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1805     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1806     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1807     EXPECT_NE(nullptr, model);
1808 }
1809 
1810 /**
1811  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_042
1812  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1813  * @tc.type: FUNC
1814  */
1815 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_042, TestSize.Level0)
1816 {
1817     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_042");
1818     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1819 
1820     float epsilon {0.0f};
1821     void* primitive = mindspore::lite::MindIR_InstanceNorm_CreatePrimitive(epsilon);
1822 
1823     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1824     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1825     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1826     EXPECT_NE(nullptr, model);
1827 }
1828 
1829 /**
1830  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_043
1831  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1832  * @tc.type: FUNC
1833  */
1834 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_043, TestSize.Level0)
1835 {
1836     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_043");
1837     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1838 
1839     float epsilon {0.0f};
1840     void* primitive = mindspore::lite::MindIR_InstanceNorm_CreatePrimitive(epsilon);
1841 
1842     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1843     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1844     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1845     EXPECT_NE(nullptr, model);
1846 }
1847 
1848 /**
1849  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_044
1850  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1851  * @tc.type: FUNC
1852  */
1853 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_044, TestSize.Level0)
1854 {
1855     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_044");
1856     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1857 
1858     std::vector<int64_t> axis;
1859     float epsilon {1e-6};
1860     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
1861     void* primitive = mindspore::lite::MindIR_L2NormalizeFusion_CreatePrimitive(axis, epsilon, activationType);
1862 
1863     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1864     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1865     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1866     EXPECT_NE(nullptr, model);
1867 }
1868 
1869 /**
1870  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_045
1871  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1872  * @tc.type: FUNC
1873  */
1874 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_045, TestSize.Level0)
1875 {
1876     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_045");
1877     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1878 
1879     int64_t beginNormAxis {1};
1880     float epsilon {1e-7};
1881     bool elementwiseAffine {true};
1882     int64_t beginParamsAxis {1};
1883     void* primitive = mindspore::lite::MindIR_LayerNormFusion_CreatePrimitive(beginNormAxis,
1884         epsilon, elementwiseAffine, beginParamsAxis);
1885 
1886     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1887     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1888     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1889     EXPECT_NE(nullptr, model);
1890 }
1891 
1892 /**
1893  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_046
1894  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1895  * @tc.type: FUNC
1896  */
1897 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_046, TestSize.Level0)
1898 {
1899     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_046");
1900     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1901 
1902     float alpha {0.0f};
1903     float minVal {0.0f};
1904     float maxVal {0.0f};
1905     bool approximate {false};
1906     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_LEAKY_RELU};
1907     void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType, alpha,
1908         minVal, maxVal, approximate);
1909 
1910     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1911     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1912     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1913     EXPECT_NE(nullptr, model);
1914 }
1915 
1916 /**
1917  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_047
1918  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1919  * @tc.type: FUNC
1920  */
1921 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_047, TestSize.Level0)
1922 {
1923     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_047");
1924     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1925 
1926     void* primitive = mindspore::lite::MindIR_Less_CreatePrimitive();
1927 
1928     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1929     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1930     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1931     EXPECT_NE(nullptr, model);
1932 }
1933 
1934 /**
1935  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_048
1936  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1937  * @tc.type: FUNC
1938  */
1939 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_048, TestSize.Level0)
1940 {
1941     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_048");
1942     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1943 
1944     void* primitive = mindspore::lite::MindIR_LessEqual_CreatePrimitive();
1945 
1946     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1947     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1948     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1949     EXPECT_NE(nullptr, model);
1950 }
1951 
1952 /**
1953  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_049
1954  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1955  * @tc.type: FUNC
1956  */
1957 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_049, TestSize.Level0)
1958 {
1959     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_049");
1960     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1961 
1962     void* primitive = mindspore::lite::MindIR_Log_CreatePrimitive();
1963 
1964     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1965     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1966     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1967     EXPECT_NE(nullptr, model);
1968 }
1969 
1970 /**
1971  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_050
1972  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1973  * @tc.type: FUNC
1974  */
1975 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_050, TestSize.Level0)
1976 {
1977     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_050");
1978     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1979 
1980     int64_t axis {0};
1981     void* primitive = mindspore::lite::MindIR_LogSoftmax_CreatePrimitive(axis);
1982 
1983     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
1984     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
1985     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
1986     EXPECT_NE(nullptr, model);
1987 }
1988 
1989 /**
1990  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_051
1991  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
1992  * @tc.type: FUNC
1993  */
1994 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_051, TestSize.Level0)
1995 {
1996     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_051");
1997     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
1998 
1999     void* primitive = mindspore::lite::MindIR_LogicalAnd_CreatePrimitive();
2000 
2001     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2002     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2003     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2004     EXPECT_NE(nullptr, model);
2005 }
2006 
2007 /**
2008  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_052
2009  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2010  * @tc.type: FUNC
2011  */
2012 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_052, TestSize.Level0)
2013 {
2014     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_052");
2015     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2016 
2017     void* primitive = mindspore::lite::MindIR_LogicalNot_CreatePrimitive();
2018 
2019     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2020     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2021     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2022     EXPECT_NE(nullptr, model);
2023 }
2024 
2025 /**
2026  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_053
2027  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2028  * @tc.type: FUNC
2029  */
2030 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_053, TestSize.Level0)
2031 {
2032     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_053");
2033     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2034 
2035     void* primitive = mindspore::lite::MindIR_LogicalOr_CreatePrimitive();
2036 
2037     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2038     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2039     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2040     EXPECT_NE(nullptr, model);
2041 }
2042 
2043 /**
2044  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_054
2045  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2046  * @tc.type: FUNC
2047  */
2048 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_054, TestSize.Level0)
2049 {
2050     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_054");
2051     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2052 
2053     int64_t depthRadius {0};
2054     float bias {0.0f};
2055     float alpha {0.0f};
2056     float beta {0.0f};
2057     std::string normRegion {"ACROSS_CHANNELS"};
2058     void* primitive = mindspore::lite::MindIR_LRN_CreatePrimitive(depthRadius, bias, alpha,
2059         beta, normRegion);
2060 
2061     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2062     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2063     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2064     EXPECT_NE(nullptr, model);
2065 }
2066 
2067 /**
2068  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_055
2069  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2070  * @tc.type: FUNC
2071  */
2072 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_055, TestSize.Level0)
2073 {
2074     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_055");
2075     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2076 
2077     bool bidirectional {false};
2078     bool hasBias {false};
2079     int64_t inputSize {0};
2080     int64_t hiddenSize {0};
2081     int64_t numLayers {0};
2082     int64_t numDirections {0};
2083     float dropout {0.0f};
2084     float zoneoutCell {0.0f};
2085     float zoneoutHidden {0.0f};
2086     int64_t projSize {0};
2087     void* primitive = mindspore::lite::MindIR_LSTM_CreatePrimitive(bidirectional, hasBias, inputSize,
2088         hiddenSize, numLayers, numDirections, dropout, zoneoutCell, zoneoutHidden, projSize);
2089 
2090     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2091     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2092     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2093     EXPECT_NE(nullptr, model);
2094 }
2095 
2096 /**
2097  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_056
2098  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2099  * @tc.type: FUNC
2100  */
2101 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_056, TestSize.Level0)
2102 {
2103     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_056");
2104     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2105 
2106     void* primitive = mindspore::lite::MindIR_Maximum_CreatePrimitive();
2107 
2108     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2109     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2110     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2111     EXPECT_NE(nullptr, model);
2112 }
2113 
2114 /**
2115  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_057
2116  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2117  * @tc.type: FUNC
2118  */
2119 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_057, TestSize.Level0)
2120 {
2121     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_057");
2122     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2123 
2124     std::vector<int64_t> kernelSize;
2125     std::vector<int64_t> pad;
2126     std::vector<int64_t> strides;
2127     mindspore::lite::PadMode padMode {mindspore::lite::PAD_MODE_PAD};
2128     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
2129     mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
2130     bool global {false};
2131     void* primitive = MindIR_MaxPoolFusion_CreatePrimitive(kernelSize, strides, pad,
2132         padMode, format, global, activationType);
2133 
2134     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2135     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2136     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2137     EXPECT_NE(nullptr, model);
2138 }
2139 
2140 /**
2141  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_058
2142  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2143  * @tc.type: FUNC
2144  */
2145 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_058, TestSize.Level0)
2146 {
2147     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_058");
2148     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2149 
2150     void* primitive = mindspore::lite::MindIR_Minimum_CreatePrimitive();
2151 
2152     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2153     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2154     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2155     EXPECT_NE(nullptr, model);
2156 }
2157 
2158 /**
2159  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_059
2160  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2161  * @tc.type: FUNC
2162  */
2163 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_059, TestSize.Level0)
2164 {
2165     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_059");
2166     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2167 
2168     void* primitive = mindspore::lite::MindIR_Mod_CreatePrimitive();
2169 
2170     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2171     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2172     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2173     EXPECT_NE(nullptr, model);
2174 }
2175 
2176 /**
2177  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_060
2178  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2179  * @tc.type: FUNC
2180  */
2181 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_060, TestSize.Level0)
2182 {
2183     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_060");
2184     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2185 
2186     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
2187     void* primitive = mindspore::lite::MindIR_MulFusion_CreatePrimitive(activationType);
2188 
2189     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2190     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2191     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2192     EXPECT_NE(nullptr, model);
2193 }
2194 
2195 /**
2196  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_061
2197  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2198  * @tc.type: FUNC
2199  */
2200 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_061, TestSize.Level0)
2201 {
2202     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_061");
2203     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2204 
2205     void* primitive = mindspore::lite::MindIR_Neg_CreatePrimitive();
2206 
2207     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2208     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2209     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2210     EXPECT_NE(nullptr, model);
2211 }
2212 
2213 /**
2214  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_062
2215  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2216  * @tc.type: FUNC
2217  */
2218 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_062, TestSize.Level0)
2219 {
2220     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_062");
2221     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2222 
2223     void* primitive = mindspore::lite::MindIR_NotEqual_CreatePrimitive();
2224 
2225     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2226     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2227     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2228     EXPECT_NE(nullptr, model);
2229 }
2230 
2231 /**
2232  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_063
2233  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2234  * @tc.type: FUNC
2235  */
2236 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_063, TestSize.Level0)
2237 {
2238     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_063");
2239     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2240 
2241     int64_t axis {-1};
2242     void* primitive = mindspore::lite::MindIR_OneHot_CreatePrimitive(axis);
2243 
2244     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2245     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2246     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2247     EXPECT_NE(nullptr, model);
2248 }
2249 
2250 /**
2251  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_064
2252  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2253  * @tc.type: FUNC
2254  */
2255 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_064, TestSize.Level0)
2256 {
2257     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_064");
2258     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2259 
2260     std::vector<std::vector<int64_t>> paddings;
2261     float constantValue {0.0f};
2262     mindspore::lite::PaddingMode paddingMode {mindspore::lite::PADDING_MODE_CONSTANT};
2263     void* primitive = MindIR_PadFusion_CreatePrimitive(paddings, paddingMode, constantValue);
2264 
2265     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2266     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2267     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2268     EXPECT_NE(nullptr, model);
2269 }
2270 
2271 /**
2272  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_065
2273  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2274  * @tc.type: FUNC
2275  */
2276 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_065, TestSize.Level0)
2277 {
2278     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_065");
2279     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2280 
2281     float scale {1.0f};
2282     float shift {0.0f};
2283     void* primitive = mindspore::lite::MindIR_PowFusion_CreatePrimitive(scale, shift);
2284 
2285     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2286     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2287     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2288     EXPECT_NE(nullptr, model);
2289 }
2290 
2291 /**
2292  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_066
2293  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2294  * @tc.type: FUNC
2295  */
2296 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_066, TestSize.Level0)
2297 {
2298     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_066");
2299     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2300 
2301     bool channelShared{false};
2302     void* primitive = mindspore::lite::MindIR_PReLUFusion_CreatePrimitive(channelShared);
2303 
2304     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2305     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2306     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2307     EXPECT_NE(nullptr, model);
2308 }
2309 
2310 /**
2311  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_067
2312  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2313  * @tc.type: FUNC
2314  */
2315 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_067, TestSize.Level0)
2316 {
2317     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_067");
2318     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2319 
2320     const uint64_t* srcT{nullptr};
2321     const uint64_t* dstT{nullptr};
2322     int64_t axis {0};
2323     void* primitive = mindspore::lite::MindIR_QuantDTypeCast_CreatePrimitive(*srcT, *dstT, axis);
2324 
2325     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2326     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2327     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2328     EXPECT_NE(nullptr, model);
2329 }
2330 
2331 /**
2332  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_068
2333  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2334  * @tc.type: FUNC
2335  */
2336 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_068, TestSize.Level0)
2337 {
2338     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_068");
2339     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2340 
2341     int64_t dType {0.0f};
2342     int64_t start {0};
2343     int64_t limit {0};
2344     int64_t delta {1};
2345     void* primitive = mindspore::lite::MindIR_Range_CreatePrimitive(dType, start, limit, delta);
2346 
2347     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2348     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2349     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2350     EXPECT_NE(nullptr, model);
2351 }
2352 
2353 /**
2354  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_069
2355  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2356  * @tc.type: FUNC
2357  */
2358 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_069, TestSize.Level0)
2359 {
2360     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_069");
2361     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2362 
2363     void* primitive = mindspore::lite::MindIR_Rank_CreatePrimitive();
2364 
2365     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2366     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2367     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2368     EXPECT_NE(nullptr, model);
2369 }
2370 
2371 /**
2372  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_070
2373  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2374  * @tc.type: FUNC
2375  */
2376 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_070, TestSize.Level0)
2377 {
2378     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_070");
2379     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2380 
2381     void* primitive = mindspore::lite::MindIR_Reciprocal_CreatePrimitive();
2382 
2383     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2384     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2385     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2386     EXPECT_NE(nullptr, model);
2387 }
2388 
2389 /**
2390  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_071
2391  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2392  * @tc.type: FUNC
2393  */
2394 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_071, TestSize.Level0)
2395 {
2396     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_071");
2397     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2398 
2399     mindspore::lite::ReduceMode mode {mindspore::lite::REDUCE_MODE_ALL};
2400     float coeff {0.0f};
2401     bool reduceToEnd {false};
2402     bool keepDims {false};
2403     void* primitive = mindspore::lite::MindIR_ReduceFusion_CreatePrimitive(keepDims, mode, reduceToEnd, coeff);
2404 
2405     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2406     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2407     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2408     EXPECT_NE(nullptr, model);
2409 }
2410 
2411 /**
2412  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_072
2413  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2414  * @tc.type: FUNC
2415  */
2416 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_072, TestSize.Level0)
2417 {
2418     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_072");
2419     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2420 
2421     float alpha{0.0f};
2422     float minVal{0.0f};
2423     float maxVal{0.0f};
2424     bool approximate{false};
2425     mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_RELU6};
2426     void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType, alpha,
2427         minVal, maxVal, approximate);
2428 
2429     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2430     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2431     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2432     EXPECT_NE(nullptr, model);
2433 }
2434 
2435 /**
2436  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_073
2437  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2438  * @tc.type: FUNC
2439  */
2440 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_073, TestSize.Level0)
2441 {
2442     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_073");
2443     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2444 
2445     void* primitive = mindspore::lite::MindIR_Reshape_CreatePrimitive();
2446 
2447     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2448     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2449     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2450     EXPECT_NE(nullptr, model);
2451 }
2452 
2453 /**
2454  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_074
2455  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2456  * @tc.type: FUNC
2457  */
2458 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_074, TestSize.Level0)
2459 {
2460     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_074");
2461     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2462 
2463     float cubicCoeff{0.0f};
2464     float extrapolationValue{0.0f};
2465     mindspore::lite::NearestMode nearestMode{mindspore::lite::NEAREST_MODE_NORMAL};
2466     mindspore::lite::ResizeMethod method {mindspore::lite::RESIZE_METHOD_LINEAR};
2467     uint64_t newHeight{0};
2468     uint64_t newWidth{0};
2469     bool preserveAspectRatio{false};
2470     mindspore::lite::CoordinateTransformMode coordinateTransformMode {
2471         mindspore::lite::COORDINATE_TRANSFORM_MODE_ASYMMETRIC};
2472     uint64_t excludeOutside{0};
2473     void* primitive = mindspore::lite::MindIR_Resize_CreatePrimitive(method, newHeight, newWidth,
2474         preserveAspectRatio, coordinateTransformMode, cubicCoeff, excludeOutside,
2475         extrapolationValue, nearestMode);
2476 
2477     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2478     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2479     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2480     EXPECT_NE(nullptr, model);
2481 }
2482 
2483 /**
2484  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_075
2485  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2486  * @tc.type: FUNC
2487  */
2488 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_075, TestSize.Level0)
2489 {
2490     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_075");
2491     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2492 
2493     void* primitive = mindspore::lite::MindIR_Round_CreatePrimitive();
2494 
2495     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2496     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2497     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2498     EXPECT_NE(nullptr, model);
2499 }
2500 
2501 /**
2502  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_076
2503  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2504  * @tc.type: FUNC
2505  */
2506 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_076, TestSize.Level0)
2507 {
2508     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_076");
2509     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2510 
2511     void* primitive = mindspore::lite::MindIR_Rsqrt_CreatePrimitive();
2512 
2513     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2514     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2515     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2516     EXPECT_NE(nullptr, model);
2517 }
2518 
2519 /**
2520  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_077
2521  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2522  * @tc.type: FUNC
2523  */
2524 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_077, TestSize.Level0)
2525 {
2526     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_077");
2527     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2528 
2529     mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
2530     const uint64_t* axis{nullptr};
2531     void* primitive = mindspore::lite::MindIR_ScaleFusion_CreatePrimitive(*axis, activationType);
2532 
2533     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2534     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2535     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2536     EXPECT_NE(nullptr, model);
2537 }
2538 
2539 /**
2540  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_078
2541  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2542  * @tc.type: FUNC
2543  */
2544 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_078, TestSize.Level0)
2545 {
2546     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_078");
2547     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2548 
2549     void* primitive = mindspore::lite::MindIR_ScatterNd_CreatePrimitive();
2550 
2551     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2552     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2553     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2554     EXPECT_NE(nullptr, model);
2555 }
2556 
2557 /**
2558  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_079
2559  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2560  * @tc.type: FUNC
2561  */
2562 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_079, TestSize.Level0)
2563 {
2564     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_079");
2565     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2566 
2567     void* primitive = mindspore::lite::MindIR_Select_CreatePrimitive();
2568 
2569     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2570     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2571     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2572     EXPECT_NE(nullptr, model);
2573 }
2574 
2575 /**
2576  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_080
2577  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2578  * @tc.type: FUNC
2579  */
2580 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_080, TestSize.Level0)
2581 {
2582     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_080");
2583     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2584 
2585     float alpha{0.0f};
2586     float minVal{0.0f};
2587     float maxVal{0.0f};
2588     bool approximate{false};
2589     mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_SIGMOID};
2590     void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType, alpha, minVal,
2591         maxVal, approximate);
2592 
2593     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2594     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2595     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2596     EXPECT_NE(nullptr, model);
2597 }
2598 
2599 /**
2600  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_081
2601  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2602  * @tc.type: FUNC
2603  */
2604 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_081, TestSize.Level0)
2605 {
2606     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_081");
2607     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2608 
2609     void* primitive = mindspore::lite::MindIR_Sin_CreatePrimitive();
2610 
2611     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2612     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2613     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2614     EXPECT_NE(nullptr, model);
2615 }
2616 
2617 /**
2618  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_082
2619  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2620  * @tc.type: FUNC
2621  */
2622 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_082, TestSize.Level0)
2623 {
2624     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_082");
2625     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2626 
2627     mindspore::lite::Format format {mindspore::lite::FORMAT_NCHW};
2628     int64_t blockSize {0};
2629     void* primitive = mindspore::lite::MindIR_SpaceToDepth_CreatePrimitive(blockSize, format);
2630 
2631     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2632     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2633     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2634     EXPECT_NE(nullptr, model);
2635 }
2636 
2637 /**
2638  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_083
2639  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2640  * @tc.type: FUNC
2641  */
2642 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_083, TestSize.Level0)
2643 {
2644     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_083");
2645     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2646 
2647     void* primitive = mindspore::lite::MindIR_SparseToDense_CreatePrimitive();
2648 
2649     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2650     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2651     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2652     EXPECT_NE(nullptr, model);
2653 }
2654 
2655 /**
2656  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_084
2657  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2658  * @tc.type: FUNC
2659  */
2660 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_084, TestSize.Level0)
2661 {
2662     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_084");
2663     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2664 
2665     void* primitive = mindspore::lite::MindIR_Square_CreatePrimitive();
2666 
2667     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2668     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2669     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2670     EXPECT_NE(nullptr, model);
2671 }
2672 
2673 /**
2674  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_085
2675  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2676  * @tc.type: FUNC
2677  */
2678 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_085, TestSize.Level0)
2679 {
2680     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_085");
2681     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2682 
2683     float alpha {0.0f};
2684     float minVal {0.0f};
2685     float maxVal {0.0f};
2686     bool approximate {false};
2687     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_SWISH};
2688     void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType, alpha,
2689         minVal, maxVal, approximate);
2690 
2691     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2692     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2693     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2694     EXPECT_NE(nullptr, model);
2695 }
2696 
2697 /**
2698  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_086
2699  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2700  * @tc.type: FUNC
2701  */
2702 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_086, TestSize.Level0)
2703 {
2704     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_086");
2705     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2706 
2707     int64_t axis {0};
2708     void* primitive = mindspore::lite::MindIR_Unstack_CreatePrimitive(axis);
2709 
2710     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2711     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2712     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2713     EXPECT_NE(nullptr, model);
2714 }
2715 
2716 /**
2717  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_087
2718  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2719  * @tc.type: FUNC
2720  */
2721 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_087, TestSize.Level0)
2722 {
2723     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_087");
2724     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2725 
2726     void* primitive = mindspore::lite::MindIR_Where_CreatePrimitive();
2727 
2728     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2729     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2730     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2731     EXPECT_NE(nullptr, model);
2732 }
2733 
2734 /**
2735  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_088
2736  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2737  * @tc.type: FUNC
2738  */
2739 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_088, TestSize.Level0)
2740 {
2741     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_088");
2742     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2743 
2744     void* primitive = mindspore::lite::MindIR_Shape_CreatePrimitive();
2745 
2746     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2747     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2748     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2749     EXPECT_NE(nullptr, model);
2750 }
2751 
2752 /**
2753  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_089
2754  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2755  * @tc.type: FUNC
2756  */
2757 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_089, TestSize.Level0)
2758 {
2759     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_089");
2760     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2761 
2762     std::vector<int64_t> axis;
2763     void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(axis);
2764 
2765     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2766     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2767     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2768     EXPECT_NE(nullptr, model);
2769 }
2770 
2771 /**
2772  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_090
2773  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2774  * @tc.type: FUNC
2775  */
2776 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_090, TestSize.Level0)
2777 {
2778     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_090");
2779     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2780 
2781     int64_t inChannel{0};
2782     int64_t outChannel{0};
2783     std::vector<int64_t> kernelSize;
2784     std::vector<int64_t> strides;
2785     std::vector<int64_t> pad;
2786     std::vector<int64_t> dilation;
2787     mindspore::lite::PadMode padMode{mindspore::lite::PAD_MODE_PAD};
2788     mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
2789     void* primitive = mindspore::lite::MindIR_Conv2DFusion_CreatePrimitive(kernelSize, strides,
2790         dilation, padMode, pad, inChannel, inChannel, outChannel, activationType);
2791 
2792     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2793     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2794     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2795     EXPECT_NE(nullptr, model);
2796 }
2797 
2798 /**
2799  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_091
2800  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2801  * @tc.type: FUNC
2802  */
2803 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_091, TestSize.Level0)
2804 {
2805     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_091");
2806     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2807 
2808     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
2809     void* primitive = mindspore::lite::MindIR_DivFusion_CreatePrimitive(activationType);
2810 
2811     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2812     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2813     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2814     EXPECT_NE(nullptr, model);
2815 }
2816 
2817 /**
2818  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_092
2819  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2820  * @tc.type: FUNC
2821  */
2822 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_092, TestSize.Level0)
2823 {
2824     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_092");
2825     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2826 
2827     mindspore::lite::ActivationType activationType{mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
2828     bool transposeA{false};
2829     bool transposeB{false};
2830     void* primitive = mindspore::lite::MindIR_MatMulFusion_CreatePrimitive(transposeA, transposeB, activationType);
2831 
2832     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2833     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2834     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2835     EXPECT_NE(nullptr, model);
2836 }
2837 
2838 /**
2839  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_093
2840  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2841  * @tc.type: FUNC
2842  */
2843 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_093, TestSize.Level0)
2844 {
2845     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_093");
2846     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2847 
2848     std::vector<int64_t> axes;
2849     void* primitive = mindspore::lite::MindIR_SliceFusion_CreatePrimitive(axes);
2850 
2851     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2852     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2853     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2854     EXPECT_NE(nullptr, model);
2855 }
2856 
2857 /**
2858  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_094
2859  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2860  * @tc.type: FUNC
2861  */
2862 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_094, TestSize.Level0)
2863 {
2864     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_094");
2865     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2866 
2867     std::vector<int64_t> axis;
2868     void* primitive = mindspore::lite::MindIR_Softmax_CreatePrimitive(axis);
2869 
2870     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2871     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2872     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2873     EXPECT_NE(nullptr, model);
2874 }
2875 
2876 /**
2877  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_095
2878  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2879  * @tc.type: FUNC
2880  */
2881 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_095, TestSize.Level0)
2882 {
2883     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_095");
2884     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2885 
2886     std::vector<std::vector<int64_t>> paddings;
2887     std::vector<int64_t> block_shape {};
2888     void* primitive = mindspore::lite::MindIR_SpaceToBatchND_CreatePrimitive(block_shape, paddings);
2889 
2890     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2891     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2892     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2893     EXPECT_NE(nullptr, model);
2894 }
2895 
2896 /**
2897  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_096
2898  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2899  * @tc.type: FUNC
2900  */
2901 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_096, TestSize.Level0)
2902 {
2903     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_096");
2904     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2905 
2906     int64_t outputNum {0};
2907     std::vector<int64_t> sizeSplits;
2908     int64_t axis {0};
2909     void* primitive = mindspore::lite::MindIR_Split_CreatePrimitive(outputNum, sizeSplits, axis);
2910 
2911     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2912     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2913     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2914     EXPECT_NE(nullptr, model);
2915 }
2916 
2917 /**
2918  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_097
2919  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2920  * @tc.type: FUNC
2921  */
2922 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_097, TestSize.Level0)
2923 {
2924     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_097");
2925     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2926 
2927     void* primitive = mindspore::lite::MindIR_Sqrt_CreatePrimitive();
2928 
2929     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2930     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2931     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2932     EXPECT_NE(nullptr, model);
2933 }
2934 
2935 /**
2936  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_098
2937  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2938  * @tc.type: FUNC
2939  */
2940 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_098, TestSize.Level0)
2941 {
2942     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_098");
2943     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2944 
2945     void* primitive = mindspore::lite::MindIR_SquaredDifference_CreatePrimitive();
2946 
2947     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2948     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2949     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2950     EXPECT_NE(nullptr, model);
2951 }
2952 
2953 /**
2954  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_099
2955  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2956  * @tc.type: FUNC
2957  */
2958 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_099, TestSize.Level0)
2959 {
2960     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_099");
2961     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2962 
2963     std::vector<int64_t> axis;
2964     void* primitive = mindspore::lite::MindIR_Squeeze_CreatePrimitive(axis);
2965 
2966     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2967     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2968     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2969     EXPECT_NE(nullptr, model);
2970 }
2971 
2972 /**
2973  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_100
2974  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2975  * @tc.type: FUNC
2976  */
2977 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_100, TestSize.Level0)
2978 {
2979     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_100");
2980     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
2981 
2982     int64_t axis = {0};
2983     void* primitive = mindspore::lite::MindIR_Stack_CreatePrimitive(axis);
2984 
2985     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
2986     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
2987     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
2988     EXPECT_NE(nullptr, model);
2989 }
2990 
2991 /**
2992  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_101
2993  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
2994  * @tc.type: FUNC
2995  */
2996 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_101, TestSize.Level0)
2997 {
2998     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_101");
2999     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3000 
3001     int64_t beginMask = {0};
3002     int64_t endMask = {0};
3003     int64_t ellipsisMask = {0};
3004     int64_t newAxisMask = {0};
3005     int64_t shrinkAxisMask = {0};
3006     void* primitive = mindspore::lite::MindIR_StridedSlice_CreatePrimitive(beginMask, endMask, ellipsisMask,
3007         newAxisMask, shrinkAxisMask);
3008 
3009     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
3010     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
3011     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3012     EXPECT_NE(nullptr, model);
3013 }
3014 
3015 /**
3016  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_102
3017  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
3018  * @tc.type: FUNC
3019  */
3020 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_102, TestSize.Level0)
3021 {
3022     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_102");
3023     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3024 
3025     mindspore::lite::ActivationType  activationType {mindspore::lite::ACTIVATION_TYPE_NO_ACTIVATION};
3026     void* primitive = mindspore::lite::MindIR_SubFusion_CreatePrimitive(activationType);
3027 
3028     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
3029     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
3030     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3031     EXPECT_NE(nullptr, model);
3032 }
3033 
3034 /**
3035  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_103
3036  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
3037  * @tc.type: FUNC
3038  */
3039 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_103, TestSize.Level0)
3040 {
3041     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_103");
3042     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3043 
3044     std::vector<int64_t> dims {0};
3045     void* primitive = mindspore::lite::MindIR_TileFusion_CreatePrimitive(dims);
3046 
3047     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
3048     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
3049     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3050     EXPECT_NE(nullptr, model);
3051 }
3052 
3053 /**
3054  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_104
3055  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
3056  * @tc.type: FUNC
3057  */
3058 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_104, TestSize.Level0)
3059 {
3060     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_104");
3061     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3062 
3063     int64_t axis {0};
3064     bool sorted {true};
3065     void* primitive = mindspore::lite::MindIR_TopKFusion_CreatePrimitive(sorted, axis);
3066 
3067     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
3068     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
3069     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3070     EXPECT_NE(nullptr, model);
3071 }
3072 
3073 /**
3074  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_105
3075  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
3076  * @tc.type: FUNC
3077  */
3078 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_105, TestSize.Level0)
3079 {
3080     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_105");
3081     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3082 
3083     void* primitive = mindspore::lite::MindIR_Transpose_CreatePrimitive();
3084 
3085     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
3086     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
3087     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3088     EXPECT_NE(nullptr, model);
3089 }
3090 
3091 /**
3092  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_106
3093  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
3094  * @tc.type: FUNC
3095  */
3096 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_106, TestSize.Level0)
3097 {
3098     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_106");
3099     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3100 
3101     std::vector<int64_t> axis;
3102     void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(axis);
3103 
3104     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
3105     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
3106     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3107     EXPECT_NE(nullptr, model);
3108 }
3109 
3110 /**
3111  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_107
3112  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
3113  * @tc.type: FUNC
3114  */
3115 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_107, TestSize.Level0)
3116 {
3117     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_107");
3118     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3119 
3120     std::vector<int64_t> axis;
3121     void* primitive = mindspore::lite::MindIR_Unsqueeze_CreatePrimitive(axis);
3122 
3123     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
3124     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
3125     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3126     EXPECT_NE(nullptr, model);
3127 }
3128 
3129 /**
3130  * @tc.name: litegraphtohdimodeltest_litegraph_to_hdimodel_108
3131  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
3132  * @tc.type: FUNC
3133  */
3134 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_litegraph_to_hdimodel_108, TestSize.Level0)
3135 {
3136     LOGE("LiteGraph_To_HDIModel litegraphtohdimodeltest_litegraph_to_hdimodel_108");
3137     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3138     MSLITE::LiteGraph::SubGraph* subGraph = new (std::nothrow) MSLITE::LiteGraph::SubGraph();
3139     subGraph->name_ = "NNRt_SubGraph";
3140     subGraph->input_indices_ = {1, 1, 1, 1};
3141     subGraph->output_indices_ = {1, 1, 1, 1};
3142     subGraph->node_indices_ = {1, 1, 1, 1};
3143 
3144     void* tp = MSLITE::MindIR_Tensor_Create();
3145 
3146     liteGraph.get()->all_tensors_.emplace_back(tp);
3147     liteGraph.get()->all_tensors_.emplace_back(nullptr);
3148     liteGraph.get()->sub_graphs_.emplace_back(subGraph);
3149 
3150     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 1, 1, 1};
3151 
3152     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3153     EXPECT_NE(nullptr, model);
3154 
3155     uint8_t *mmapPtr = static_cast<uint8_t *>(mmap(nullptr,
3156         tensorBuffer.bufferSize, PROT_READ | PROT_WRITE, MAP_SHARED, tensorBuffer.fd, 0));
3157     EXPECT_EQ(MAP_FAILED, mmapPtr);
3158 }
3159 
3160 /**
3161  * @tc.name: litegraphtohdimodeltest_hdimodel_destroy_001
3162  * @tc.desc: Verify the QuantParams function return nullptr in case of fd -1.
3163  * @tc.type: FUNC
3164  */
3165 HWTEST_F(LiteGraphToHDIModelTest, litegraphtohdimodeltest_hdimodel_destroy_001, TestSize.Level0)
3166 {
3167     LOGE("HDIModel_Destroy litegraphtohdimodeltest_hdimodel_destroy_001");
3168     std::shared_ptr<MSLITE::LiteGraph> liteGraph = std::make_shared<MSLITE::LiteGraph>();
3169 
3170     float alpha {0.0f};
3171     float minVal {0.0f};
3172     float maxVal {0.0f};
3173     bool approximate {false};
3174     mindspore::lite::ActivationType activationType {mindspore::lite::ACTIVATION_TYPE_ABS};
3175 
3176     void* primitive = mindspore::lite::MindIR_Activation_CreatePrimitive(activationType, alpha,
3177         minVal, maxVal, approximate);
3178 
3179     liteGraph.get()->all_nodes_.emplace_back(getNode(primitive));
3180     OHOS::HDI::Nnrt::V2_1::SharedBuffer tensorBuffer {-1, 0, 0, 0};
3181     OHOS::HDI::Nnrt::V2_1::Model * model = LiteGraph_To_HDIModel(liteGraph.get(), tensorBuffer);
3182     EXPECT_NE(nullptr, model);
3183     HDIModel_Destroy(&model);
3184 }
3185 } // namespace UnitTest
3186 } // namespace V1
3187 } // namespace NeuralNetworkRuntime
3188 } // namespace OHOS