362 #if (!defined(ARMNN_CAFFE_PARSER) \ 363 && !defined(ARMNN_ONNX_PARSER) \ 364 && !defined(ARMNN_TF_PARSER) \ 365 && !defined(ARMNN_TF_LITE_PARSER)) 366 ARMNN_LOG(fatal) <<
"Not built with any of the supported parsers, Caffe, Onnx, Tensorflow, or TfLite.";
370 #if !defined(ARMNN_SERIALIZER) 371 ARMNN_LOG(fatal) <<
"Not built with Serializer support.";
383 std::string modelFormat;
384 std::string modelPath;
386 std::vector<std::string> inputNames;
387 std::vector<std::string> inputTensorShapeStrs;
388 std::vector<armnn::TensorShape> inputTensorShapes;
390 std::vector<std::string> outputNames;
391 std::string outputPath;
393 bool isModelBinary =
true;
395 if (ParseCommandLineArgs(
396 argc, argv, modelFormat, modelPath, inputNames, inputTensorShapeStrs, outputNames, outputPath, isModelBinary)
402 for (
const std::string& shapeStr : inputTensorShapeStrs)
404 if (!shapeStr.empty())
406 std::stringstream ss(shapeStr);
411 inputTensorShapes.push_back(shape);
415 ARMNN_LOG(fatal) <<
"Cannot create tensor shape: " << e.
what();
421 ArmnnConverter converter(modelPath, inputNames, inputTensorShapes, outputNames, outputPath, isModelBinary);
423 if (modelFormat.find(
"caffe") != std::string::npos)
425 #if defined(ARMNN_CAFFE_PARSER) 428 ARMNN_LOG(fatal) <<
"Failed to load model from file";
432 ARMNN_LOG(fatal) <<
"Not built with Caffe parser support.";
436 else if (modelFormat.find(
"onnx") != std::string::npos)
438 #if defined(ARMNN_ONNX_PARSER) 441 ARMNN_LOG(fatal) <<
"Failed to load model from file";
445 ARMNN_LOG(fatal) <<
"Not built with Onnx parser support.";
449 else if (modelFormat.find(
"tensorflow") != std::string::npos)
451 #if defined(ARMNN_TF_PARSER) 454 ARMNN_LOG(fatal) <<
"Failed to load model from file";
458 ARMNN_LOG(fatal) <<
"Not built with Tensorflow parser support.";
462 else if (modelFormat.find(
"tflite") != std::string::npos)
464 #if defined(ARMNN_TF_LITE_PARSER) 467 ARMNN_LOG(fatal) <<
"Unknown model format: '" << modelFormat <<
"'. Only 'binary' format supported \ 474 ARMNN_LOG(fatal) <<
"Failed to load model from file";
478 ARMNN_LOG(fatal) <<
"Not built with TfLite parser support.";
484 ARMNN_LOG(fatal) <<
"Unknown model format: '" << modelFormat <<
"'";
488 if (!converter.Serialize())
490 ARMNN_LOG(fatal) <<
"Failed to serialize model";
void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)
#define ARMNN_LOG(severity)
virtual const char * what() const noexcept override
Parses a directed acyclic graph from a tensorflow protobuf file.