32 "circle-tensordump allows users to retrieve tensor information from a Circle model file"};
34 arser.add_argument(
"circle").help(
"Circle file path to dump");
35 arser.add_argument(
"--tensors").nargs(0).help(
"Dump to console");
36 arser.add_argument(
"--tensors_to_hdf5")
37 .help(
"Dump to hdf5 file. Specify hdf5 file path to be dumped");
41 arser.parse(argc, argv);
43 catch (
const std::runtime_error &err)
45 std::cout << err.what() << std::endl;
50 if (
arser[
"--tensors_to_hdf5"] ==
arser[
"--tensors"])
52 std::cout <<
"[Error] You must specify one option for how to print." << std::endl;
57 std::unique_ptr<circletensordump::DumpInterface>
dump;
59 std::string model_file =
arser.get<std::string>(
"circle");
60 std::string output_path;
61 if (
arser[
"--tensors_to_hdf5"])
63 dump = std::move(std::make_unique<circletensordump::DumpTensorsToHdf5>());
64 output_path =
arser.get<std::string>(
"--tensors_to_hdf5");
66 if (
arser[
"--tensors"])
68 dump = std::move(std::make_unique<circletensordump::DumpTensors>());
73 std::vector<char> modelData = fileLoader.
load();
74 const circle::Model *circleModel = circle::GetModel(modelData.data());
75 if (circleModel ==
nullptr)
77 std::cerr <<
"ERROR: Failed to load circle '" << model_file <<
"'" << std::endl;
81 dump->run(std::cout, circleModel, output_path);