19#include <arser/arser.h>
28 arser.add_argument(
"tflite").help(
"Source tflite file path to convert");
29 arser.add_argument(
"recipe").help(
"Target recipe file path");
33 arser.parse(argc, argv);
35 catch (
const std::runtime_error &err)
37 std::cout << err.what() << std::endl;
42 std::string tflite_path =
arser.get<std::string>(
"tflite");
45 std::vector<char> modelData = fileLoader.
load();
46 const tflite::Model *tflmodel = tflite::GetModel(modelData.data());
47 if (tflmodel ==
nullptr)
49 std::cerr <<
"ERROR: Failed to load tflite '" << tflite_path <<
"'" << std::endl;
55 if (recipe.get() ==
nullptr)
57 std::cerr <<
"ERROR: Failed to generate recipe" << std::endl;
61 std::string recipe_path =
arser.get<std::string>(
"recipe");
66 std::cerr <<
"ERROR: Failed to write to recipe '" << recipe_path <<
"'" << std::endl;
DataBuffer load(void) const
int entry(int argc, char **argv)
Dump IR for given arguments.
bool write_recipe(const std::string &filename, std::unique_ptr< ModelRecipe > &recipe)
Write ModelRecipe to file with given name.
std::unique_ptr< ModelRecipe > generate_recipe(const tflite::Model *model)
Create ModelRecipe from tflite::Model.