#include <armnn/Logging.hpp>
#include <HeapProfiling.hpp>
#include <armnn/utility/NumericCast.hpp>
#include <armnn/utility/StringUtils.hpp>
#include <cxxopts/cxxopts.hpp>
#include <fmt/format.h>
#include <cstdlib>
#include <fstream>
#include <iostream>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ CXXOPTS_VECTOR_DELIMITER
#define CXXOPTS_VECTOR_DELIMITER '.' |
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
- Examples
- AsyncExecutionSample.cpp, CustomMemoryAllocatorSample.cpp, DynamicSample.cpp, and SimpleSample.cpp.
Definition at line 327 of file ArmnnConverter.cpp.
330 #if (!defined(ARMNN_ONNX_PARSER) \
331 && !defined(ARMNN_TF_PARSER) \
332 && !defined(ARMNN_TF_LITE_PARSER))
333 ARMNN_LOG(fatal) <<
"Not built with any of the supported parsers Onnx, Tensorflow, or TfLite.";
337 #if !defined(ARMNN_SERIALIZER)
338 ARMNN_LOG(fatal) <<
"Not built with Serializer support.";
350 std::string modelFormat;
351 std::string modelPath;
353 std::vector<std::string> inputNames;
354 std::vector<std::string> inputTensorShapeStrs;
355 std::vector<armnn::TensorShape> inputTensorShapes;
357 std::vector<std::string> outputNames;
358 std::string outputPath;
360 bool isModelBinary =
true;
362 if (ParseCommandLineArgs(
363 argc, argv, modelFormat, modelPath, inputNames, inputTensorShapeStrs, outputNames, outputPath, isModelBinary)
369 for (
const std::string& shapeStr : inputTensorShapeStrs)
371 if (!shapeStr.empty())
373 std::stringstream ss(shapeStr);
378 inputTensorShapes.push_back(shape);
382 ARMNN_LOG(fatal) <<
"Cannot create tensor shape: " << e.
what();
388 ArmnnConverter converter(modelPath, inputNames, inputTensorShapes, outputNames, outputPath, isModelBinary);
392 if (modelFormat.find(
"onnx") != std::string::npos)
394 #if defined(ARMNN_ONNX_PARSER)
397 ARMNN_LOG(fatal) <<
"Failed to load model from file";
401 ARMNN_LOG(fatal) <<
"Not built with Onnx parser support.";
405 else if (modelFormat.find(
"tflite") != std::string::npos)
407 #if defined(ARMNN_TF_LITE_PARSER)
410 ARMNN_LOG(fatal) <<
"Unknown model format: '" << modelFormat <<
"'. Only 'binary' format supported \
417 ARMNN_LOG(fatal) <<
"Failed to load model from file";
421 ARMNN_LOG(fatal) <<
"Not built with TfLite parser support.";
427 ARMNN_LOG(fatal) <<
"Unknown model format: '" << modelFormat <<
"'";
433 ARMNN_LOG(fatal) <<
"Failed to load model from file: " << e.
what();
437 if (!converter.Serialize())
439 ARMNN_LOG(fatal) <<
"Failed to serialize model";
References ARMNN_LOG, armnn::ConfigureLogging(), armnn::Debug, armnn::Info, and Exception::what().