| 177 | |
| 178 | template <typename Tout> |
| 179 | bool 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 | |
| 219 | template <typename Tout> |
| 220 | Size ArmnnNetworkExecutor<Tout>::GetImageAspectRatio() |
no test coverage detected