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";
void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)
Configures the logging behaviour of the ARMNN library.
virtual const char * what() const noexcept override
#define ARMNN_LOG(severity)
Base class for all ArmNN exceptions so that users can filter to just those.