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 "ops/split_builder.h"
17
18 #include <gtest/gtest.h>
19 #include "nn_tensor.h"
20 #include "ops_test.h"
21
22 using namespace testing;
23 using namespace testing::ext;
24 using namespace OHOS::NeuralNetworkRuntime::Ops;
25
26 namespace OHOS {
27 namespace NeuralNetworkRuntime {
28 namespace UnitTest {
29 class SplitBuilderTest : public OpsTest {
30 protected:
31 void InitTensor(const std::vector<uint32_t>& inputsIndex,
32 const std::vector<uint32_t>& outputsIndex) override;
33 void SaveAxisTensor(OH_NN_DataType dataType, const std::vector<int32_t> &dim,
34 const OH_NN_QuantParam* quantParam, OH_NN_TensorType type);
35 void SaveOutputNumTensor(OH_NN_DataType dataType, const std::vector<int32_t> &dim,
36 const OH_NN_QuantParam* quantParam, OH_NN_TensorType type);
37 void SaveSizeSplitsTensor(OH_NN_DataType dataType, const std::vector<int32_t> &dim,
38 const OH_NN_QuantParam* quantParam, OH_NN_TensorType type);
39
40 protected:
41 SplitBuilder m_builder;
42 int64_t m_expectOutputNum {0};
43 int64_t m_expectAxis {0};
44 std::vector<int64_t> m_expectSizeSplitsValue;
45 };
46
InitTensor(const std::vector<uint32_t> & inputsIndex,const std::vector<uint32_t> & outputsIndex)47 void SplitBuilderTest::InitTensor(const std::vector<uint32_t>& inputsIndex, const std::vector<uint32_t>& outputsIndex)
48 {
49 std::vector<uint32_t> paramsIndex = { 3, 4, 5 };
50 std::vector<int32_t> inputDim = {2, 4};
51 std::vector<int32_t> OutputDim = {1, 4, 0, 0};
52
53 m_paramsIndex = paramsIndex;
54 SaveInputTensor(inputsIndex, OH_NN_FLOAT32, inputDim, nullptr);
55 SaveOutputTensor(outputsIndex, OH_NN_FLOAT32, OutputDim, nullptr);
56 }
57
SaveOutputNumTensor(OH_NN_DataType dataType,const std::vector<int32_t> & dim,const OH_NN_QuantParam * quantParam,OH_NN_TensorType type)58 void SplitBuilderTest::SaveOutputNumTensor(OH_NN_DataType dataType,
59 const std::vector<int32_t> &dim, const OH_NN_QuantParam* quantParam, OH_NN_TensorType type)
60 {
61 std::shared_ptr<NNTensor> outputNumTensor = TransToNNTensor(dataType, dim, quantParam, type);
62 int64_t* outputNumValue = new (std::nothrow) int64_t[1]{2};
63 EXPECT_NE(nullptr, outputNumValue);
64 outputNumTensor->SetBuffer(outputNumValue, sizeof(int64_t));
65 m_allTensors.emplace_back(outputNumTensor);
66 m_expectOutputNum = *outputNumValue;
67 }
68
SaveSizeSplitsTensor(OH_NN_DataType dataType,const std::vector<int32_t> & dim,const OH_NN_QuantParam * quantParam,OH_NN_TensorType type)69 void SplitBuilderTest::SaveSizeSplitsTensor(OH_NN_DataType dataType,
70 const std::vector<int32_t> &dim, const OH_NN_QuantParam* quantParam, OH_NN_TensorType type)
71 {
72 const int sizeSplitsLen = 2;
73 std::shared_ptr<NNTensor> sizeSplitsTensor = TransToNNTensor(dataType, dim, quantParam, type);
74 int64_t* sizeSplitsValue = new (std::nothrow) int64_t[sizeSplitsLen] {0, 0};
75 EXPECT_NE(nullptr, sizeSplitsValue);
76 sizeSplitsTensor->SetBuffer(sizeSplitsValue, sizeof(int64_t) * sizeSplitsLen);
77 m_allTensors.emplace_back(sizeSplitsTensor);
78 m_expectSizeSplitsValue.assign(sizeSplitsValue, sizeSplitsValue + sizeSplitsLen);
79 }
80
SaveAxisTensor(OH_NN_DataType dataType,const std::vector<int32_t> & dim,const OH_NN_QuantParam * quantParam,OH_NN_TensorType type)81 void SplitBuilderTest::SaveAxisTensor(OH_NN_DataType dataType, const std::vector<int32_t> &dim,
82 const OH_NN_QuantParam* quantParam, OH_NN_TensorType type)
83 {
84 std::shared_ptr<NNTensor> axisTensor = TransToNNTensor(dataType, dim, quantParam, type);
85 int64_t* axisValue = new (std::nothrow) int64_t[1]{0};
86 EXPECT_NE(nullptr, axisValue);
87 axisTensor->SetBuffer(axisValue, sizeof(int64_t));
88 m_allTensors.emplace_back(axisTensor);
89 m_expectAxis = *axisValue;
90 }
91
92 /**
93 * @tc.name: split_build_001
94 * @tc.desc: Provide normal input, output, and parameters to verify the normal behavior of the Build function
95 * @tc.type: FUNC
96 */
97 HWTEST_F(SplitBuilderTest, split_build_001, TestSize.Level0)
98 {
99 std::vector<uint32_t> inputsIndex = { 0 };
100 std::vector<uint32_t> outputsIndex = { 1, 2 };
101 std::vector<int32_t> paramDim = {};
102
103 InitTensor(inputsIndex, outputsIndex);
104
105 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
106 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
107 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
108 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
109 EXPECT_EQ(OH_NN_SUCCESS, ret);
110 }
111
112 /**
113 * @tc.name: split_build_002
114 * @tc.desc: Call Build func twice to verify the abnormal behavior of the Build function
115 * @tc.type: FUNC
116 */
117 HWTEST_F(SplitBuilderTest, split_build_002, TestSize.Level0)
118 {
119 std::vector<uint32_t> inputsIndex = { 0 };
120 std::vector<uint32_t> outputsIndex = { 1, 2 };
121 std::vector<int32_t> paramDim = {};
122
123 InitTensor(inputsIndex, outputsIndex);
124 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
125 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
126 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
127
128 EXPECT_EQ(OH_NN_SUCCESS, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors));
129 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
130 EXPECT_EQ(OH_NN_OPERATION_FORBIDDEN, ret);
131 }
132
133 /**
134 * @tc.name: split_build_003
135 * @tc.desc: Provide one more than normal input to verify the abnormal behavior of the Build function
136 * @tc.type: FUNC
137 */
138 HWTEST_F(SplitBuilderTest, split_build_003, TestSize.Level0)
139 {
140 std::vector<uint32_t> inputsIndex = { 0, 1 };
141 std::vector<uint32_t> outputsIndex = { 2, 3 };
142 std::vector<int32_t> paramDim = {};
143
144 InitTensor(inputsIndex, outputsIndex);
145 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
146 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
147 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
148
149 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
150 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
151 }
152
153 /**
154 * @tc.name: split_build_004
155 * @tc.desc: Provide one more than normal output to verify the abnormal behavior of the Build function
156 * @tc.type: FUNC
157 */
158 HWTEST_F(SplitBuilderTest, split_build_004, TestSize.Level0)
159 {
160 std::vector<uint32_t> inputsIndex = { 0 };
161 std::vector<uint32_t> outputsIndex = { 1, 2, 3 };
162 std::vector<int32_t> paramDim = {};
163
164 InitTensor(inputsIndex, outputsIndex);
165
166 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
167 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
168 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
169
170 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
171 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
172 }
173
174 /**
175 * @tc.name: split_build_005
176 * @tc.desc: Provide empty input, output, and parameters to verify the abnormal behavior of the Build function
177 * @tc.type: FUNC
178 */
179 HWTEST_F(SplitBuilderTest, split_build_005, TestSize.Level0)
180 {
181 std::vector<uint32_t> inputsIndex = { 0, 1, 2, 3 };
182 std::vector<uint32_t> outputsIndex = { 4, 5 };
183 std::vector<uint32_t> paramsIndex = { 6, 7, 8 };
184 OH_NN_ReturnCode ret = m_builder.Build(paramsIndex, inputsIndex, outputsIndex, m_allTensors);
185 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
186 }
187
188 /**
189 * @tc.name: split_build_006
190 * @tc.desc: Provide axis param type error to verify the abnormal behavior of the Build function
191 * @tc.type: FUNC
192 */
193 HWTEST_F(SplitBuilderTest, split_build_006, TestSize.Level0)
194 {
195 std::vector<uint32_t> inputsIndex = { 0 };
196 std::vector<uint32_t> outputsIndex = { 1, 2 };
197 std::vector<int32_t> paramDim = {};
198
199 InitTensor(inputsIndex, outputsIndex);
200 SaveAxisTensor(OH_NN_INT8, paramDim, nullptr, OH_NN_SPLIT_AXIS);
201 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
202 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
203
204 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
205 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
206 }
207
208 /**
209 * @tc.name: split_build_007
210 * @tc.desc: Provide axis param type error to verify the abnormal behavior of the Build function
211 * @tc.type: FUNC
212 */
213 HWTEST_F(SplitBuilderTest, split_build_007, TestSize.Level0)
214 {
215 std::vector<uint32_t> inputsIndex = { 0 };
216 std::vector<uint32_t> outputsIndex = { 1, 2 };
217 std::vector<int32_t> paramDim = {};
218
219 InitTensor(inputsIndex, outputsIndex);
220 SaveAxisTensor(OH_NN_INT32, paramDim, nullptr, OH_NN_SPLIT_AXIS);
221 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
222 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
223
224 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
225 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
226 }
227
228 /**
229 * @tc.name: split_build_008
230 * @tc.desc: Provide size splits param type error to verify the abnormal behavior of the Build function
231 * @tc.type: FUNC
232 */
233 HWTEST_F(SplitBuilderTest, split_build_008, TestSize.Level0)
234 {
235 std::vector<uint32_t> inputsIndex = { 0 };
236 std::vector<uint32_t> outputsIndex = { 1, 2 };
237 std::vector<int32_t> paramDim = {};
238
239 InitTensor(inputsIndex, outputsIndex);
240 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
241 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
242 SaveSizeSplitsTensor(OH_NN_INT32, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
243
244 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
245 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
246 }
247
248 /**
249 * @tc.name: split_build_009
250 * @tc.desc: Provide output num param type error to verify the abnormal behavior of the Build function
251 * @tc.type: FUNC
252 */
253 HWTEST_F(SplitBuilderTest, split_build_009, TestSize.Level0)
254 {
255 std::vector<uint32_t> inputsIndex = { 0 };
256 std::vector<uint32_t> outputsIndex = { 1, 2 };
257 std::vector<int32_t> paramDim = {};
258
259 InitTensor(inputsIndex, outputsIndex);
260 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
261 SaveOutputNumTensor(OH_NN_INT32, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
262 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
263
264 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
265 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
266 }
267
268 /**
269 * @tc.name: split_build_010
270 * @tc.desc: Provide axis param type error to verify the abnormal behavior of the Build function
271 * @tc.type: FUNC
272 */
273 HWTEST_F(SplitBuilderTest, split_build_010, TestSize.Level0)
274 {
275 std::vector<uint32_t> inputsIndex = { 0 };
276 std::vector<uint32_t> outputsIndex = { 1, 2 };
277 std::vector<int32_t> paramDim = {};
278
279 InitTensor(inputsIndex, outputsIndex);
280 SaveAxisTensor(OH_NN_BOOL, paramDim, nullptr, OH_NN_SPLIT_AXIS);
281 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
282 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
283
284 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
285 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
286 }
287
288 /**
289 * @tc.name: split_build_011
290 * @tc.desc: Provide axis parameter buffer is nullptr to verify the abnormal behavior of the Build function
291 * @tc.type: FUNC
292 */
293 HWTEST_F(SplitBuilderTest, split_build_011, TestSize.Level0)
294 {
295 std::vector<uint32_t> inputsIndex = { 0 };
296 std::vector<uint32_t> outputsIndex = { 1, 2 };
297 std::vector<int32_t> paramDim = {};
298
299 InitTensor(inputsIndex, outputsIndex);
300
301 std::shared_ptr<NNTensor> axisTensor = TransToNNTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
302 axisTensor->SetBuffer(nullptr, 0);
303 m_allTensors.emplace_back(axisTensor);
304
305 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
306 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
307 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
308 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
309 }
310
311 /**
312 * @tc.name: split_build_012
313 * @tc.desc: Provide invalid parameter type to verify the abnormal behavior of the Build function
314 * @tc.type: FUNC
315 */
316 HWTEST_F(SplitBuilderTest, split_build_012, TestSize.Level0)
317 {
318 std::vector<uint32_t> inputsIndex = { 0 };
319 std::vector<uint32_t> outputsIndex = { 1, 2 };
320 std::vector<int32_t> paramDim = {};
321
322 InitTensor(inputsIndex, outputsIndex);
323 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
324 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
325 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SCALE_AXIS);
326 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
327 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
328 }
329
330 /**
331 * @tc.name: split_build_013
332 * @tc.desc: Provide axis parameter not scalar to verify the abnormal behavior of the Build function
333 * @tc.type: FUNC
334 */
335 HWTEST_F(SplitBuilderTest, split_build_013, TestSize.Level0)
336 {
337 std::vector<uint32_t> inputsIndex = { 0 };
338 std::vector<uint32_t> outputsIndex = { 1, 2 };
339 std::vector<int32_t> paramDim = {};
340 std::vector<int32_t> axisDim = {1, 2};
341
342 InitTensor(inputsIndex, outputsIndex);
343 SaveAxisTensor(OH_NN_INT64, axisDim, nullptr, OH_NN_SPLIT_AXIS);
344 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
345 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
346 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
347 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
348 }
349
350 /**
351 * @tc.name: split_build_014
352 * @tc.desc: Provide output parameter not scalar to verify the abnormal behavior of the Build function
353 * @tc.type: FUNC
354 */
355 HWTEST_F(SplitBuilderTest, split_build_014, TestSize.Level0)
356 {
357 std::vector<uint32_t> inputsIndex = { 0 };
358 std::vector<uint32_t> outputsIndex = { 1, 2 };
359 std::vector<int32_t> paramDim = {};
360 std::vector<int32_t> outputNumDim = {1, 2};
361
362 InitTensor(inputsIndex, outputsIndex);
363 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
364 SaveOutputNumTensor(OH_NN_INT64, outputNumDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
365 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
366 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
367 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
368 }
369
370 /**
371 * @tc.name: split_build_015
372 * @tc.desc: Provide empty output and param to verify the abnormal behavior of the Build function
373 * @tc.type: FUNC
374 */
375 HWTEST_F(SplitBuilderTest, split_build_015, TestSize.Level0)
376 {
377 std::vector<uint32_t> inputsIndex = { 1 };
378 std::vector<uint32_t> outputsIndex = {};
379 std::vector<uint32_t> paramsIndex = {};
380 std::vector<int32_t> inputDim = {2, 4};
381
382 m_paramsIndex = paramsIndex;
383 SaveInputTensor(inputsIndex, OH_NN_FLOAT32, inputDim, nullptr);
384 OH_NN_ReturnCode ret = m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors);
385 EXPECT_EQ(OH_NN_INVALID_PARAMETER, ret);
386 }
387
388 /**
389 * @tc.name: split_getprimitive_001
390 * @tc.desc: Verify the GetPrimitive function return nullptr
391 * @tc.type: FUNC
392 */
393 HWTEST_F(SplitBuilderTest, split_getprimitive_001, TestSize.Level0)
394 {
395 LiteGraphTensorPtr primitive = m_builder.GetPrimitive();
396 LiteGraphTensorPtr expectPrimitive(nullptr, DestroyLiteGraphPrimitive);
397 EXPECT_EQ(primitive, expectPrimitive);
398 }
399
400 /**
401 * @tc.name: split_getprimitive_002
402 * @tc.desc: Verify the normal params return behavior of the getprimitive function
403 * @tc.type: FUNC
404 */
405 HWTEST_F(SplitBuilderTest, split_getprimitive_002, TestSize.Level0)
406 {
407 std::vector<uint32_t> inputsIndex = { 0 };
408 std::vector<uint32_t> outputsIndex = { 1, 2 };
409 std::vector<int32_t> paramDim = {};
410
411 InitTensor(inputsIndex, outputsIndex);
412 SaveAxisTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_AXIS);
413 SaveOutputNumTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_OUTPUT_NUM);
414 SaveSizeSplitsTensor(OH_NN_INT64, paramDim, nullptr, OH_NN_SPLIT_SIZE_SPLITS);
415
416 EXPECT_EQ(OH_NN_SUCCESS, m_builder.Build(m_paramsIndex, m_inputsIndex, m_outputsIndex, m_allTensors));
417 LiteGraphTensorPtr primitive = m_builder.GetPrimitive();
418 LiteGraphTensorPtr expectPrimitive(nullptr, DestroyLiteGraphPrimitive);
419 EXPECT_NE(expectPrimitive, primitive);
420
421 auto returnValue = mindspore::lite::MindIR_Split_GetSizeSplits(primitive.get());
422 auto returnValueSize = returnValue.size();
423 for (size_t i = 0; i < returnValueSize; ++i) {
424 EXPECT_EQ(returnValue[i], m_expectSizeSplitsValue[i]);
425 }
426
427 auto returnOutputNum = mindspore::lite::MindIR_Split_GetOutputNum(primitive.get());
428 EXPECT_EQ(returnOutputNum, m_expectOutputNum);
429
430 auto returnAxis = mindspore::lite::MindIR_Split_GetAxis(primitive.get());
431 EXPECT_EQ(returnAxis, m_expectAxis);
432 }
433 } // namespace UnitTest
434 } // namespace NeuralNetworkRuntime
435 } // namespace OHOS
436