MAIN
| 33 | |
| 34 | // MAIN |
| 35 | int main(int argc, const char* argv[]) |
| 36 | { |
| 37 | // Configures logging for both the ARMNN library and this test program. |
| 38 | #ifdef NDEBUG |
| 39 | armnn::LogSeverity level = armnn::LogSeverity::Info; |
| 40 | #else |
| 41 | armnn::LogSeverity level = armnn::LogSeverity::Debug; |
| 42 | #endif |
| 43 | armnn::ConfigureLogging(true, true, level); |
| 44 | |
| 45 | // Get ExecuteNetwork parameters and runtime options from command line |
| 46 | // This might throw an InvalidArgumentException if the user provided invalid inputs |
| 47 | ProgramOptions programOptions; |
| 48 | try |
| 49 | { |
| 50 | programOptions.ParseOptions(argc, argv); |
| 51 | } |
| 52 | catch (const std::exception& e) |
| 53 | { |
| 54 | ARMNN_LOG(fatal) << e.what(); |
| 55 | return EXIT_FAILURE; |
| 56 | } |
| 57 | |
| 58 | std::vector<const void*> outputResults; |
| 59 | std::unique_ptr<IExecutor> executor; |
| 60 | try |
| 61 | { |
| 62 | executor = BuildExecutor(programOptions); |
| 63 | if ((!executor) || (executor->m_constructionFailed)) |
| 64 | { |
| 65 | return EXIT_FAILURE; |
| 66 | } |
| 67 | } |
| 68 | catch (const std::exception& e) |
| 69 | { |
| 70 | ARMNN_LOG(fatal) << e.what(); |
| 71 | return EXIT_FAILURE; |
| 72 | } |
| 73 | |
| 74 | executor->PrintNetworkInfo(); |
| 75 | outputResults = executor->Execute(); |
| 76 | |
| 77 | if (!programOptions.m_ExNetParams.m_ComparisonComputeDevices.empty() || |
| 78 | programOptions.m_ExNetParams.m_CompareWithTflite) |
| 79 | { |
| 80 | // Here we're reusing programOptions.m_ExNetParams for the comparison executor. Modify the compute device and |
| 81 | // the executor. |
| 82 | programOptions.m_ExNetParams.m_ComputeDevices = programOptions.m_ExNetParams.m_ComparisonComputeDevices; |
| 83 | if (programOptions.m_ExNetParams.m_CompareWithTflite) |
| 84 | { |
| 85 | programOptions.m_ExNetParams.m_TfLiteExecutor = ExecuteNetworkParams::TfLiteExecutor::TfliteInterpreter; |
| 86 | } |
| 87 | |
| 88 | auto comparisonExecutor = BuildExecutor(programOptions); |
| 89 | |
| 90 | if (!comparisonExecutor) |
| 91 | { |
| 92 | return EXIT_FAILURE; |
nothing calls this directly
no test coverage detected