#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 329 of file ArmnnConverter.cpp.
332 #if (!defined(ARMNN_ONNX_PARSER) \
333 && !defined(ARMNN_TF_PARSER) \
334 && !defined(ARMNN_TF_LITE_PARSER))
335 ARMNN_LOG(fatal) <<
"Not built with any of the supported parsers Onnx, Tensorflow, or TfLite.";
339 #if !defined(ARMNN_SERIALIZER)
340 ARMNN_LOG(fatal) <<
"Not built with Serializer support.";
352 std::string modelFormat;
353 std::string modelPath;
355 std::vector<std::string> inputNames;
356 std::vector<std::string> inputTensorShapeStrs;
357 std::vector<armnn::TensorShape> inputTensorShapes;
359 std::vector<std::string> outputNames;
360 std::string outputPath;
362 bool isModelBinary =
true;
364 if (ParseCommandLineArgs(
365 argc, argv, modelFormat, modelPath, inputNames, inputTensorShapeStrs, outputNames, outputPath, isModelBinary)
371 for (
const std::string& shapeStr : inputTensorShapeStrs)
373 if (!shapeStr.empty())
375 std::stringstream ss(shapeStr);
380 inputTensorShapes.push_back(shape);
384 ARMNN_LOG(fatal) <<
"Cannot create tensor shape: " << e.
what();
390 ArmnnConverter converter(modelPath, inputNames, inputTensorShapes, outputNames, outputPath, isModelBinary);
394 if (modelFormat.find(
"onnx") != std::string::npos)
396 #if defined(ARMNN_ONNX_PARSER)
399 ARMNN_LOG(fatal) <<
"Failed to load model from file";
403 ARMNN_LOG(fatal) <<
"Not built with Onnx parser support.";
407 else if (modelFormat.find(
"tflite") != std::string::npos)
409 #if defined(ARMNN_TF_LITE_PARSER)
412 ARMNN_LOG(fatal) <<
"Unknown model format: '" << modelFormat <<
"'. Only 'binary' format supported \
419 ARMNN_LOG(fatal) <<
"Failed to load model from file";
423 ARMNN_LOG(fatal) <<
"Not built with TfLite parser support.";
429 ARMNN_LOG(fatal) <<
"Unknown model format: '" << modelFormat <<
"'";
435 ARMNN_LOG(fatal) <<
"Failed to load model from file: " << e.
what();
439 if (!converter.Serialize())
441 ARMNN_LOG(fatal) <<
"Failed to serialize model";
References ARMNN_LOG, armnn::ConfigureLogging(), armnn::Debug, armnn::Info, and Exception::what().