| 625 | |
| 626 | template <typename T> |
| 627 | void TransposeConvTest(tflite::TensorType tensorType, |
| 628 | uint32_t strideX, |
| 629 | uint32_t strideY, |
| 630 | tflite::Padding padding, |
| 631 | const std::vector <int32_t>& transposeTensorShape, |
| 632 | const std::vector <int32_t>& filterTensorShape, |
| 633 | const std::vector <int32_t>& inputTensorShape, |
| 634 | const std::vector <int32_t>& outputTensorShape, |
| 635 | const std::vector <int32_t>& transposeData, |
| 636 | const std::vector <T>& filterData, |
| 637 | std::vector<T>& inputValues, |
| 638 | std::vector<T>& expectedOutputValues, |
| 639 | float filterScale = 1.0f, |
| 640 | int filterOffset = 0, |
| 641 | float outputQuantScale = 1.0f, |
| 642 | int outputQuantOffset = 0, |
| 643 | float quantScale = 1.0f, |
| 644 | int quantOffset = 0, |
| 645 | const std::vector<armnn::BackendId>& backends = {}) |
| 646 | { |
| 647 | using namespace delegateTestInterpreter; |
| 648 | |
| 649 | std::vector<char> modelBuffer; |
| 650 | modelBuffer = CreateTransposeConvTfLiteModel<T>(tensorType, |
| 651 | strideX, |
| 652 | strideY, |
| 653 | padding, |
| 654 | transposeTensorShape, |
| 655 | filterTensorShape, |
| 656 | inputTensorShape, |
| 657 | outputTensorShape, |
| 658 | transposeData, |
| 659 | filterData, |
| 660 | filterScale, |
| 661 | filterOffset, |
| 662 | outputQuantScale, |
| 663 | outputQuantOffset, |
| 664 | quantScale, |
| 665 | quantOffset); |
| 666 | |
| 667 | |
| 668 | // Setup interpreter with just TFLite Runtime. |
| 669 | auto tfLiteInterpreter = DelegateTestInterpreter(modelBuffer); |
| 670 | CHECK(tfLiteInterpreter.AllocateTensors() == kTfLiteOk); |
| 671 | CHECK(tfLiteInterpreter.FillInputTensor<T>(inputValues, 2) == kTfLiteOk); |
| 672 | CHECK(tfLiteInterpreter.Invoke() == kTfLiteOk); |
| 673 | std::vector<T> tfLiteOutputValues = tfLiteInterpreter.GetOutputResult<T>(0); |
| 674 | std::vector<int32_t> tfLiteOutputShape = tfLiteInterpreter.GetOutputShape(0); |
| 675 | |
| 676 | // Setup interpreter with Arm NN Delegate applied. |
| 677 | auto armnnInterpreter = DelegateTestInterpreter(modelBuffer, CaptureAvailableBackends(backends)); |
| 678 | CHECK(armnnInterpreter.AllocateTensors() == kTfLiteOk); |
| 679 | CHECK(armnnInterpreter.FillInputTensor<T>(inputValues, 2) == kTfLiteOk); |
| 680 | CHECK(armnnInterpreter.Invoke() == kTfLiteOk); |
| 681 | std::vector<T> armnnOutputValues = armnnInterpreter.GetOutputResult<T>(0); |
| 682 | std::vector<int32_t> armnnOutputShape = armnnInterpreter.GetOutputShape(0); |
| 683 | |
| 684 | armnnDelegate::CompareOutputData<T>(tfLiteOutputValues, armnnOutputValues, expectedOutputValues); |
nothing calls this directly
no test coverage detected