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

Function ResizeFP32TestImpl

delegate/test/ResizeTestHelper.hpp:116–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void ResizeFP32TestImpl(tflite::BuiltinOperator operatorCode,
117 std::vector<float>& input1Values,
118 std::vector<int32_t> input1Shape,
119 std::vector<int32_t> input2NewShape,
120 std::vector<int32_t> input2Shape,
121 std::vector<float>& expectedOutputValues,
122 std::vector<int32_t> expectedOutputShape,
123 const std::vector<armnn::BackendId>& backends = {})
124{
125 using namespace delegateTestInterpreter;
126
127 std::vector<char> modelBuffer = CreateResizeTfLiteModel(operatorCode,
128 ::tflite::TensorType_FLOAT32,
129 input1Shape,
130 input2NewShape,
131 input2Shape,
132 expectedOutputShape);
133
134 // Setup interpreter with just TFLite Runtime.
135 auto tfLiteInterpreter = DelegateTestInterpreter(modelBuffer);
136 CHECK(tfLiteInterpreter.AllocateTensors() == kTfLiteOk);
137 CHECK(tfLiteInterpreter.FillInputTensor<float>(input1Values, 0) == kTfLiteOk);
138 CHECK(tfLiteInterpreter.FillInputTensor<int32_t>(input2NewShape, 1) == kTfLiteOk);
139 CHECK(tfLiteInterpreter.Invoke() == kTfLiteOk);
140 std::vector<float> tfLiteOutputValues = tfLiteInterpreter.GetOutputResult<float>(0);
141 std::vector<int32_t> tfLiteOutputShape = tfLiteInterpreter.GetOutputShape(0);
142
143 // Setup interpreter with Arm NN Delegate applied.
144 auto armnnInterpreter = DelegateTestInterpreter(modelBuffer, CaptureAvailableBackends(backends));
145 CHECK(armnnInterpreter.AllocateTensors() == kTfLiteOk);
146 CHECK(armnnInterpreter.FillInputTensor<float>(input1Values, 0) == kTfLiteOk);
147 CHECK(armnnInterpreter.FillInputTensor<int32_t>(input2NewShape, 1) == kTfLiteOk);
148 CHECK(armnnInterpreter.Invoke() == kTfLiteOk);
149 std::vector<float> armnnOutputValues = armnnInterpreter.GetOutputResult<float>(0);
150 std::vector<int32_t> armnnOutputShape = armnnInterpreter.GetOutputShape(0);
151
152 armnnDelegate::CompareOutputData<float>(tfLiteOutputValues, armnnOutputValues, expectedOutputValues);
153 armnnDelegate::CompareOutputShape(tfLiteOutputShape, armnnOutputShape, expectedOutputShape);
154
155 tfLiteInterpreter.Cleanup();
156 armnnInterpreter.Cleanup();
157}
158
159} // anonymous namespace

Callers 2

Calls 8

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

Tested by

no test coverage detected