27std::string quote(
const std::string &s) {
return "'" +
s +
"'"; }
29std::unique_ptr<mir::Graph>
import(
const std::string &onnx_path)
34std::unique_ptr<loco::Graph> transform(
const std::unique_ptr<mir::Graph> &mir_graph)
37 return transformer.
transform(mir_graph.get());
42 std::cout <<
"Usage: onnx2tflite <mode> <path/to/onnx> <path/to/output>\n"
43 "Modes: -t (text file); -b (binary file)"
52int main(
int argc,
char **argv)
61 std::string mode{argv[1]};
62 std::string onnx_path{argv[2]};
63 std::string tflite_path{argv[3]};
65 std::cout <<
"Import " << quote(onnx_path) << std::endl;
66 std::unique_ptr<mir::Graph> mir_graph;
69 else if (mode ==
"-b")
76 std::cout <<
"Import " << quote(onnx_path) <<
" - Done" << std::endl;
78 auto loco_graph = transform(mir_graph);
void dumpToFile(const char *path) const
write to a file
std::unique_ptr< mir::Graph > loadModel(const std::string &filename)
std::unique_ptr< mir::Graph > importModelFromTextFile(const std::string &filename)
std::unique_ptr< mir::Graph > importModelFromBinaryFile(const std::string &filename)