| 346 | } |
| 347 | |
| 348 | void PadUint8Test(tflite::BuiltinOperator padOperatorCode = tflite::BuiltinOperator_PAD, |
| 349 | uint8_t paddingValue = 0, |
| 350 | uint8_t p = 3, |
| 351 | float quantizationScale = -2.0f, |
| 352 | int32_t quantizationOffset = 3) |
| 353 | { |
| 354 | // Set input data |
| 355 | std::vector<int32_t> inputShape { 2, 2, 2 }; |
| 356 | std::vector<int32_t> outputShape { 3, 5, 6 }; |
| 357 | std::vector<int32_t> paddingShape { 3, 2 }; |
| 358 | |
| 359 | std::vector<uint8_t> inputValues = { 0, 4, |
| 360 | 2, 5, |
| 361 | 6, 1, |
| 362 | 5, 2 }; |
| 363 | |
| 364 | std::vector<uint8_t> expectedOutputValues = { p, p, p, p, p, p, |
| 365 | p, p, p, p, p, p, |
| 366 | p, p, 0, 4, p, p, |
| 367 | p, p, 2, 5, p, p, |
| 368 | p, p, p, p, p, p, |
| 369 | |
| 370 | p, p, p, p, p, p, |
| 371 | p, p, p, p, p, p, |
| 372 | p, p, 6, 1, p, p, |
| 373 | p, p, 5, 2, p, p, |
| 374 | p, p, p, p, p, p, |
| 375 | |
| 376 | p, p, p, p, p, p, |
| 377 | p, p, p, p, p, p, |
| 378 | p, p, p, p, p, p, |
| 379 | p, p, p, p, p, p, |
| 380 | p, p, p, p, p, p }; |
| 381 | |
| 382 | std::vector<int32_t> paddingDim = { 0, 1, 2, 1, 2, 2 }; |
| 383 | |
| 384 | PadTest<uint8_t>(padOperatorCode, |
| 385 | ::tflite::TensorType_UINT8, |
| 386 | inputShape, |
| 387 | paddingShape, |
| 388 | outputShape, |
| 389 | inputValues, |
| 390 | paddingDim, |
| 391 | expectedOutputValues, |
| 392 | paddingValue, |
| 393 | {}, |
| 394 | quantizationScale, |
| 395 | quantizationOffset); |
| 396 | } |
| 397 | |
| 398 | TEST_SUITE("PadTests") |
| 399 | { |