MCPcopy Create free account
hub / github.com/ARM-software/armnn / TransposeConvTest

Function TransposeConvTest

delegate/test/ConvolutionTestHelper.hpp:627–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625
626template <typename T>
627void 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);

Callers

nothing calls this directly

Calls 7

CaptureAvailableBackendsFunction · 0.85
CompareOutputShapeFunction · 0.85
AllocateTensorsMethod · 0.80
InvokeMethod · 0.45
GetOutputShapeMethod · 0.45
CleanupMethod · 0.45

Tested by

no test coverage detected