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 <gtest/gtest.h> 17 #include <gmock/gmock.h> 18 19 #include "validation.h" 20 #include "nn_tensor.h" 21 22 using namespace testing; 23 using namespace testing::ext; 24 using namespace OHOS::NeuralNetworkRuntime; 25 using namespace OHOS::NeuralNetworkRuntime::Validation; 26 27 namespace NNRT { 28 namespace UnitTest { 29 class NnTensorTest : public testing::Test { 30 }; 31 32 /** 33 * @tc.name: nn_tensor_parse_dimensions_001 34 * @tc.desc: Verify the success of the parse_dimensions function 35 * @tc.type: FUNC 36 */ 37 HWTEST_F(NnTensorTest, nn_tensor_parse_dimensions_001, TestSize.Level1) 38 { 39 const int dim[2] = {2, 2}; 40 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 41 42 NNTensor nnTensor; 43 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 44 } 45 46 /** 47 * @tc.name: nn_tensor_parse_dimensions_002 48 * @tc.desc: Verify the invalid dimensions of the parse_dimensions function 49 * @tc.type: FUNC 50 */ 51 HWTEST_F(NnTensorTest, nn_tensor_parse_dimensions_002, TestSize.Level1) 52 { 53 OH_NN_Tensor tensor; 54 tensor.dataType = OH_NN_FLOAT32; 55 tensor.dimensionCount = 2; 56 tensor.dimensions = nullptr; 57 tensor.quantParam = nullptr; 58 tensor.type = OH_NN_TENSOR; 59 60 NNTensor nnTensor; 61 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.BuildFromOHNNTensor(tensor)); 62 } 63 64 /** 65 * @tc.name: nn_tensor_parse_dimensions_003 66 * @tc.desc: Verify the invalid shape tensor of the parse_dimensions function 67 * @tc.type: FUNC 68 */ 69 HWTEST_F(NnTensorTest, nn_tensor_parse_dimensions_003, TestSize.Level1) 70 { 71 const int dim[2] = {2, -2}; 72 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 73 74 NNTensor nnTensor; 75 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.BuildFromOHNNTensor(tensor)); 76 } 77 78 /** 79 * @tc.name: nn_tensor_parse_dimensions_004 80 * @tc.desc: Verify the dynamic shape of the parse_dimensions function 81 * @tc.type: FUNC 82 */ 83 HWTEST_F(NnTensorTest, nn_tensor_parse_dimensions_004, TestSize.Level1) 84 { 85 const int dim[2] = {2, -1}; 86 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 87 88 NNTensor nnTensor; 89 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 90 } 91 92 /** 93 * @tc.name: nn_tensor_parse_dimensions_005 94 * @tc.desc: Verify the dims out of bounds of the parse_dimensions function 95 * @tc.type: FUNC 96 */ 97 HWTEST_F(NnTensorTest, nn_tensor_parse_dimensions_005, TestSize.Level1) 98 { 99 const int dim[3] = {1000000, 1000000, 10000000}; 100 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 101 102 NNTensor nnTensor; 103 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.BuildFromOHNNTensor(tensor)); 104 } 105 106 107 /** 108 * @tc.name: nn_tensor_parse_quant_params_001 109 * @tc.desc: Verify the success of the parse_quant_params function 110 * @tc.type: FUNC 111 */ 112 HWTEST_F(NnTensorTest, nn_tensor_parse_quant_params_001, TestSize.Level1) 113 { 114 const double scale = 1.0; 115 const int32_t zeroPoint = 0; 116 const uint32_t numBits = 8; 117 const OH_NN_QuantParam quantParam = {1, &numBits, &scale, &zeroPoint}; 118 119 NNTensor nnTensor; 120 const int dim[2] = {2, 2}; 121 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, &quantParam, OH_NN_TENSOR}; 122 123 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 124 } 125 126 /** 127 * @tc.name: nn_tensor_parse_quant_params_002 128 * @tc.desc: Verify the invalid numbits of the parse_quant_params function 129 * @tc.type: FUNC 130 */ 131 HWTEST_F(NnTensorTest, nn_tensor_parse_quant_params_002, TestSize.Level1) 132 { 133 const double scale = 1.0; 134 const int32_t zeroPoint = 0; 135 const uint32_t numBits = 16; 136 const OH_NN_QuantParam quantParam = {1, &numBits, &scale, &zeroPoint}; 137 138 NNTensor nnTensor; 139 const int dim[2] = {2, 2}; 140 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, &quantParam, OH_NN_TENSOR}; 141 142 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.BuildFromOHNNTensor(tensor)); 143 } 144 145 /** 146 * @tc.name: nn_tensor_parse_quant_params_004 147 * @tc.desc: Verify the invalid scale of the parse_quant_params function 148 * @tc.type: FUNC 149 */ 150 HWTEST_F(NnTensorTest, nn_tensor_parse_quant_params_004, TestSize.Level1) 151 { 152 const int32_t zeroPoint = 0; 153 const uint32_t numBits = 8; 154 const OH_NN_QuantParam quantParam = {1, &numBits, nullptr, &zeroPoint}; 155 156 NNTensor nnTensor; 157 const int dim[2] = {2, 2}; 158 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, &quantParam, OH_NN_TENSOR}; 159 160 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.BuildFromOHNNTensor(tensor)); 161 } 162 163 /** 164 * @tc.name: nn_tensor_parse_quant_params_005 165 * @tc.desc: Verify the invalid zeropoint of the parse_quant_params function 166 * @tc.type: FUNC 167 */ 168 HWTEST_F(NnTensorTest, nn_tensor_parse_quant_params_005, TestSize.Level1) 169 { 170 const double scale = 1.0; 171 const uint32_t numBits = 8; 172 const OH_NN_QuantParam quantParam = {1, &numBits, &scale, nullptr}; 173 174 NNTensor nnTensor; 175 const int dim[2] = {2, 2}; 176 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, &quantParam, OH_NN_TENSOR}; 177 178 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.BuildFromOHNNTensor(tensor)); 179 } 180 181 /** 182 * @tc.name: nn_tensor_set_dimensions_001 183 * @tc.desc: Verify the success of the set_dimensions function 184 * @tc.type: FUNC 185 */ 186 HWTEST_F(NnTensorTest, nn_tensor_set_dimensions_001, TestSize.Level1) 187 { 188 const int dim[2] = {2, -1}; 189 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 190 const std::vector<int32_t> dimensions = {2, 3}; 191 192 NNTensor nnTensor; 193 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 194 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.SetDimensions(dimensions)); 195 } 196 197 /** 198 * @tc.name: nn_tensor_set_dimensions_002 199 * @tc.desc: Verify the dim out of bounds of the set_dimensions function 200 * @tc.type: FUNC 201 */ 202 HWTEST_F(NnTensorTest, nn_tensor_set_dimensions_002, TestSize.Level1) 203 { 204 const int dim[2] = {2, -1}; 205 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 206 207 NNTensor nnTensor; 208 const std::vector<int32_t> dimensions = {2, 3, 5}; 209 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 210 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.SetDimensions(dimensions)); 211 } 212 213 /** 214 * @tc.name: nn_tensor_compare_attribute_001 215 * @tc.desc: Verify the success of the CompareAttribute function 216 * @tc.type: FUNC 217 */ 218 HWTEST_F(NnTensorTest, nn_tensor_compare_attribute_001, TestSize.Level1) 219 { 220 const int dim[2] = {2, 2}; 221 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 222 223 NNTensor nnTensor; 224 NNTensor expectTensor; 225 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 226 expectTensor = std::move(nnTensor); 227 EXPECT_EQ(true, nnTensor.CompareAttribute(nnTensor)); 228 } 229 230 /** 231 * @tc.name: nn_tensor_compare_attribute_002 232 * @tc.desc: Verify the datatype not equal of the CompareAttribute function 233 * @tc.type: FUNC 234 */ 235 HWTEST_F(NnTensorTest, nn_tensor_compare_attribute_002, TestSize.Level1) 236 { 237 const int dim[2] = {2, 2}; 238 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 239 240 NNTensor nnTensor; 241 NNTensor expectTensor; 242 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 243 244 const int dimExpect[2] = {2, 2}; 245 OH_NN_Tensor tensorExpect {OH_NN_INT32, 2, dimExpect, nullptr, OH_NN_TENSOR}; 246 EXPECT_EQ(OH_NN_SUCCESS, expectTensor.BuildFromOHNNTensor(tensorExpect)); 247 248 EXPECT_EQ(false, nnTensor.CompareAttribute(expectTensor)); 249 } 250 251 /** 252 * @tc.name: nn_tensor_compare_attribute_003 253 * @tc.desc: Verify the dim size not equal of the CompareAttribute function 254 * @tc.type: FUNC 255 */ 256 HWTEST_F(NnTensorTest, nn_tensor_compare_attribute_003, TestSize.Level1) 257 { 258 const int dim[2] = {2, 2}; 259 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 260 261 NNTensor nnTensor; 262 NNTensor expectTensor; 263 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 264 265 const int dimExpect[3] = {2, 2, 3}; 266 OH_NN_Tensor tensorExpect {OH_NN_FLOAT32, 3, dimExpect, nullptr, OH_NN_TENSOR}; 267 EXPECT_EQ(OH_NN_SUCCESS, expectTensor.BuildFromOHNNTensor(tensorExpect)); 268 269 EXPECT_EQ(false, nnTensor.CompareAttribute(expectTensor)); 270 } 271 272 /** 273 * @tc.name: nn_tensor_compare_attribute_004 274 * @tc.desc: Verify the dim value not equal of the CompareAttribute function 275 * @tc.type: FUNC 276 */ 277 HWTEST_F(NnTensorTest, nn_tensor_compare_attribute_004, TestSize.Level1) 278 { 279 const int dim[2] = {2, 2}; 280 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 281 282 NNTensor nnTensor; 283 NNTensor expectTensor; 284 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 285 286 const int dimExpect[2] = {2, 3}; 287 OH_NN_Tensor tensorExpect {OH_NN_FLOAT32, 2, dimExpect, nullptr, OH_NN_TENSOR}; 288 EXPECT_EQ(OH_NN_SUCCESS, expectTensor.BuildFromOHNNTensor(tensorExpect)); 289 290 EXPECT_EQ(false, nnTensor.CompareAttribute(expectTensor)); 291 } 292 293 /** 294 * @tc.name: nn_tensor_is_scalar_001 295 * @tc.desc: Verify the success of the is_scalar function 296 * @tc.type: FUNC 297 */ 298 HWTEST_F(NnTensorTest, nn_tensor_is_scalar_001, TestSize.Level1) 299 { 300 const int dim[2] = {2, 2}; 301 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 302 303 NNTensor nnTensor; 304 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 305 EXPECT_EQ(false, nnTensor.IsScalar()); 306 } 307 308 /** 309 * @tc.name: nn_tensor_build_from_tensor_001 310 * @tc.desc: Verify the success of the build_from_tensor function 311 * @tc.type: FUNC 312 */ 313 HWTEST_F(NnTensorTest, nn_tensor_convert_to_io_tensor_001, TestSize.Level1) 314 { 315 const int dim[2] = {2, 2}; 316 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 317 318 NNTensor nnTensor; 319 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 320 321 int8_t* activationValue = new (std::nothrow) int8_t[1] {0}; 322 EXPECT_NE(nullptr, activationValue); 323 324 // After SetBuffer, this memory is released by NNTensor 325 nnTensor.SetBuffer(activationValue, sizeof(int8_t)); 326 IOTensor ioTensor; 327 nnTensor.ConvertToIOTensor(ioTensor); 328 EXPECT_EQ(sizeof(int8_t), ioTensor.length); 329 } 330 331 /** 332 * @tc.name: nn_tensor_get_buffer_length_001 333 * @tc.desc: Verify the success of the get_buffer_length function 334 * @tc.type: FUNC 335 */ 336 HWTEST_F(NnTensorTest, nn_tensor_get_buffer_length_001, TestSize.Level1) 337 { 338 const int dim[2] = {2, 2}; 339 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 340 341 NNTensor nnTensor; 342 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 343 int8_t* activationValue = new (std::nothrow) int8_t[1] {0}; 344 EXPECT_NE(nullptr, activationValue); 345 346 // After SetBuffer, this memory is released by NNTensor 347 nnTensor.SetBuffer(activationValue, sizeof(int8_t)); 348 size_t length = sizeof(int8_t); 349 EXPECT_EQ(length, nnTensor.GetBufferLength()); 350 } 351 352 /** 353 * @tc.name: nn_tensor_get_format_001 354 * @tc.desc: Verify the success of the get_format function 355 * @tc.type: FUNC 356 */ 357 HWTEST_F(NnTensorTest, nn_tensor_get_format_001, TestSize.Level1) 358 { 359 const int dim[2] = {2, 2}; 360 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 361 362 NNTensor nnTensor; 363 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 364 OH_NN_Format format = OH_NN_FORMAT_NHWC; 365 EXPECT_EQ(format, nnTensor.GetFormat()); 366 } 367 368 /** 369 * @tc.name: nn_tensor_get_name_001 370 * @tc.desc: Verify the success of the get name function 371 * @tc.type: FUNC 372 */ 373 HWTEST_F(NnTensorTest, nn_tensor_get_name_001, TestSize.Level1) 374 { 375 NNTensor nnTensor; 376 const std::string& name = "test"; 377 nnTensor.SetName(name); 378 EXPECT_EQ(name, nnTensor.GetName()); 379 } 380 381 /** 382 * @tc.name: nn_tensor_get_quant_param_001 383 * @tc.desc: Verify the success of the get_quant_param function 384 * @tc.type: FUNC 385 */ 386 HWTEST_F(NnTensorTest, nn_tensor_get_quant_param_001, TestSize.Level1) 387 { 388 const int dim[2] = {2, 2}; 389 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 390 391 NNTensor nnTensor; 392 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 393 394 std::vector<QuantParam> quantParam = nnTensor.GetQuantParam(); 395 size_t quantSize = 0; 396 EXPECT_EQ(quantSize, quantParam.size()); 397 } 398 399 /** 400 * @tc.name: nn_tensor_build_from_tensor_002 401 * @tc.desc: Verify the invalid datatype value of the build_from_tensor function 402 * @tc.type: FUNC 403 */ 404 HWTEST_F(NnTensorTest, nn_tensor_build_from_tensor_002, TestSize.Level1) 405 { 406 const int dim[2] = {2, 2}; 407 408 int dataTypeTest = 13; 409 OH_NN_DataType dataType = (OH_NN_DataType)dataTypeTest; 410 OH_NN_Tensor tensor {dataType, 2, dim, nullptr, OH_NN_TENSOR}; 411 412 NNTensor nnTensor; 413 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.BuildFromOHNNTensor(tensor)); 414 } 415 416 /** 417 * @tc.name: nn_tensor_convert_to_lite_graph_tensor_001 418 * @tc.desc: Verify the success of the convert_to_lite_graph function 419 * @tc.type: FUNC 420 */ 421 HWTEST_F(NnTensorTest, nn_tensor_convert_to_lite_graph_tensor_001, TestSize.Level1) 422 { 423 const int dim[2] = {2, 2}; 424 OH_NN_Tensor tensor {OH_NN_FLOAT32, 2, dim, nullptr, OH_NN_TENSOR}; 425 426 NNTensor nnTensor; 427 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 428 429 LiteGraphTensorPtr tensorPtr = {nullptr, DestroyLiteGraphTensor}; 430 EXPECT_NE(tensorPtr, nnTensor.ConvertToLiteGraphTensor()); 431 } 432 433 /** 434 * @tc.name: nn_tensor_convert_to_lite_graph_tensor_002 435 * @tc.desc: Verify the success with quant of the convert_to_lite_graph function 436 * @tc.type: FUNC 437 */ 438 HWTEST_F(NnTensorTest, nn_tensor_convert_to_lite_graph_tensor_002, TestSize.Level1) 439 { 440 const int dim[2] = {2, 2}; 441 442 OH_NN_Tensor tensor; 443 tensor.dataType = OH_NN_FLOAT32; 444 tensor.dimensionCount = 2; 445 tensor.dimensions = dim; 446 const double scale = 1.0; 447 const int32_t zeroPoint = 0; 448 const uint32_t numBits = 8; 449 const OH_NN_QuantParam quantParam = {1, &numBits, &scale, &zeroPoint}; 450 tensor.quantParam = &quantParam; 451 tensor.type = OH_NN_TENSOR; 452 453 NNTensor nnTensor; 454 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.BuildFromOHNNTensor(tensor)); 455 456 LiteGraphTensorPtr tensorPtr = {nullptr, DestroyLiteGraphTensor}; 457 EXPECT_NE(tensorPtr, nnTensor.ConvertToLiteGraphTensor()); 458 } 459 460 /** 461 * @tc.name: nn_tensor_build_001 462 * @tc.desc: Verify the success of the build function 463 * @tc.type: FUNC 464 */ 465 HWTEST_F(NnTensorTest, nn_tensor_build_001, TestSize.Level1) 466 { 467 OH_NN_DataType dataType = OH_NN_FLOAT32; 468 const std::vector<int32_t> dimensions = {2, 2}; 469 const std::vector<QuantParam> quantParam = {{8, 1.0, 0}, {8, 1.0, 0}, {8, 1.0, 0}}; 470 OH_NN_TensorType type = OH_NN_ADD_ACTIVATIONTYPE; 471 472 NNTensor nnTensor; 473 EXPECT_EQ(OH_NN_SUCCESS, nnTensor.Build(dataType, dimensions, quantParam, type)); 474 } 475 476 /** 477 * @tc.name: nn_tensor_build_002 478 * @tc.desc: Verify the invalid datatype value of the build function 479 * @tc.type: FUNC 480 */ 481 HWTEST_F(NnTensorTest, nn_tensor_build_002, TestSize.Level1) 482 { 483 int dataTypeTest = 13; 484 OH_NN_DataType dataType = (OH_NN_DataType)dataTypeTest; 485 const std::vector<int32_t> dimensions = {2, 2}; 486 const std::vector<QuantParam> quantParam = {{8, 1.0, 0}, {8, 1.0, 0}, {8, 1.0, 0}}; 487 OH_NN_TensorType type = OH_NN_ADD_ACTIVATIONTYPE; 488 489 NNTensor nnTensor; 490 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.Build(dataType, dimensions, quantParam, type)); 491 } 492 493 /** 494 * @tc.name: nn_tensor_build_003 495 * @tc.desc: Verify the dynamic shape of the build function 496 * @tc.type: FUNC 497 */ 498 HWTEST_F(NnTensorTest, nn_tensor_build_003, TestSize.Level1) 499 { 500 OH_NN_DataType dataType = OH_NN_FLOAT32; 501 const std::vector<int32_t> dimensions = {2, -2}; 502 const std::vector<QuantParam> quantParam = {{8, 1.0, 0}, {8, 1.0, 0}, {8, 1.0, 0}}; 503 OH_NN_TensorType type = OH_NN_ADD_ACTIVATIONTYPE; 504 505 NNTensor nnTensor; 506 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.Build(dataType, dimensions, quantParam, type)); 507 } 508 509 /** 510 * @tc.name: nn_tensor_build_004 511 * @tc.desc: Verify the invalid numbits of the build function 512 * @tc.type: FUNC 513 */ 514 HWTEST_F(NnTensorTest, nn_tensor_build_004, TestSize.Level1) 515 { 516 OH_NN_DataType dataType = OH_NN_FLOAT32; 517 const std::vector<int32_t> dimensions = {2, 2}; 518 const std::vector<QuantParam> quantParam = {{2, 1.0, 0}, {2, 1.0, 0}, {2, 1.0, 0}}; 519 OH_NN_TensorType type = OH_NN_ADD_ACTIVATIONTYPE; 520 521 NNTensor nnTensor; 522 EXPECT_EQ(OH_NN_INVALID_PARAMETER, nnTensor.Build(dataType, dimensions, quantParam, type)); 523 } 524 } // namespace UnitTest 525 } // namespace NNRT 526