| 505 | } |
| 506 | |
| 507 | void ProgramOptions::ParseOptions(int ac, const char* av[]) |
| 508 | { |
| 509 | // Parses the command-line. |
| 510 | m_CxxResult = m_CxxOptions.parse(ac, av); |
| 511 | |
| 512 | if (m_CxxResult.count("help") || ac <= 1) |
| 513 | { |
| 514 | std::cout << m_CxxOptions.help() << std::endl; |
| 515 | exit(EXIT_SUCCESS); |
| 516 | } |
| 517 | |
| 518 | CheckRequiredOptions(m_CxxResult); |
| 519 | CheckOptionDependencies(m_CxxResult); |
| 520 | CheckForDeprecatedOptions(m_CxxResult); |
| 521 | |
| 522 | if ((m_ExNetParams.m_OutputDetailsToStdOut || |
| 523 | m_ExNetParams.m_OutputDetailsOnlyToStdOut) && |
| 524 | !m_ExNetParams.m_EnableProfiling) |
| 525 | { |
| 526 | throw cxxopts::exceptions::exception("You must enable profiling if you would like to output layer details"); |
| 527 | } |
| 528 | |
| 529 | // Some options can't be assigned directly because they need some post-processing: |
| 530 | auto computeDevices = GetOptionValue<std::vector<std::string>>("compute", m_CxxResult); |
| 531 | m_ExNetParams.m_ComputeDevices = GetBackendIDs(computeDevices); |
| 532 | m_ExNetParams.m_InputNames = |
| 533 | ParseStringList(GetOptionValue<std::string>("input-name", m_CxxResult), ","); |
| 534 | m_ExNetParams.m_InputTensorDataFilePaths = |
| 535 | ParseStringList(GetOptionValue<std::string>("input-tensor-data", m_CxxResult), ","); |
| 536 | m_ExNetParams.m_OutputNames = |
| 537 | ParseStringList(GetOptionValue<std::string>("output-name", m_CxxResult), ","); |
| 538 | m_ExNetParams.m_OutputTensorFiles = |
| 539 | ParseStringList(GetOptionValue<std::string>("write-outputs-to-file", m_CxxResult), ","); |
| 540 | m_ExNetParams.m_GenerateTensorData = m_ExNetParams.m_InputTensorDataFilePaths.empty(); |
| 541 | m_ExNetParams.m_DynamicBackendsPath = m_RuntimeOptions.m_DynamicBackendsPath; |
| 542 | |
| 543 | m_RuntimeOptions.m_EnableGpuProfiling = m_ExNetParams.m_EnableProfiling; |
| 544 | |
| 545 | std::string tfliteExecutor = GetOptionValue<std::string>("tflite-executor", m_CxxResult); |
| 546 | |
| 547 | if (tfliteExecutor.size() == 0 || tfliteExecutor == "parser") |
| 548 | { |
| 549 | m_ExNetParams.m_TfLiteExecutor = ExecuteNetworkParams::TfLiteExecutor::ArmNNTfLiteParser; |
| 550 | } |
| 551 | else if (tfliteExecutor == "opaquedelegate") |
| 552 | { |
| 553 | m_ExNetParams.m_TfLiteExecutor = ExecuteNetworkParams::TfLiteExecutor::ArmNNTfLiteOpaqueDelegate; |
| 554 | } |
| 555 | else if (tfliteExecutor == "delegate") |
| 556 | { |
| 557 | m_ExNetParams.m_TfLiteExecutor = ExecuteNetworkParams::TfLiteExecutor::ArmNNTfLiteDelegate; |
| 558 | } |
| 559 | else if (tfliteExecutor == "tflite") |
| 560 | { |
| 561 | m_ExNetParams.m_TfLiteExecutor = ExecuteNetworkParams::TfLiteExecutor::TfliteInterpreter; |
| 562 | } |
| 563 | else |
| 564 | { |
no test coverage detected