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

Method Run

samples/ObjectDetection/include/delegate/ArmnnNetworkExecutor.hpp:179–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177
178template <typename Tout>
179bool ArmnnNetworkExecutor<Tout>::Run(const void *inputData, const size_t dataBytes,
180 InferenceResults<Tout>& outResults)
181{
182 bool ret = false;
183 m_profiling.ProfilingStart();
184 PrepareTensors(inputData, dataBytes);
185
186 if (m_interpreter->Invoke() == kTfLiteOk)
187 {
188
189
190 ret = true;
191 // Extract the output tensor data.
192 outResults.clear();
193 outResults.reserve(m_interpreter->outputs().size());
194 for (int index = 0; index < m_interpreter->outputs().size(); index++)
195 {
196 size_t size = m_interpreter->output_tensor(index)->bytes / sizeof(Tout);
197 const Tout *p_Output = m_interpreter->typed_output_tensor<Tout>(index);
198 if (p_Output != nullptr) {
199 InferenceResult<float> outRes(p_Output, p_Output + size);
200 outResults.emplace_back(outRes);
201 }
202 else
203 {
204 const std::string errorMessage{"ArmnnNetworkExecutor: p_Output tensor is null"};
205 ARMNN_LOG(error) << errorMessage;
206 ret = false;
207 }
208 }
209 }
210 else
211 {
212 const std::string errorMessage{"ArmnnNetworkExecutor: Invoke has failed"};
213 ARMNN_LOG(error) << errorMessage;
214 }
215 m_profiling.ProfilingStopAndPrintUs("Perform inference");
216 return ret;
217}
218
219template <typename Tout>
220Size ArmnnNetworkExecutor<Tout>::GetImageAspectRatio()

Callers 2

InferenceMethod · 0.45

Calls 6

ProfilingStartMethod · 0.80
InvokeMethod · 0.45
clearMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected