| 35 | bool cmdOptionExists(char**, char**, const std::string&); |
| 36 | |
| 37 | int main(int argc, char** argv) |
| 38 | { |
| 39 | if(argc < 2) |
| 40 | { |
| 41 | std::cout << "Usage: " << argv[0] << " <input_file> " |
| 42 | << "[options]" << std::endl; |
| 43 | std::cout << "options:" << std::endl; |
| 44 | std::cout << "\t--parse onnx" << std::endl; |
| 45 | std::cout << "\t--load json/msgpack" << std::endl; |
| 46 | std::cout << "\t--save <output_file>" << std::endl; |
| 47 | return 0; |
| 48 | } |
| 49 | |
| 50 | char* load_arg = getCmdOption(argv + 2, argv + argc, "--load"); |
| 51 | char* save_arg = getCmdOption(argv + 2, argv + argc, "--save"); |
| 52 | const char* input_file = argv[1]; |
| 53 | |
| 54 | migraphx::program p; |
| 55 | |
| 56 | if(cmdOptionExists(argv + 2, argv + argc, "--parse") or |
| 57 | not cmdOptionExists(argv + 2, argv + argc, "--load")) |
| 58 | { |
| 59 | std::cout << "Parsing ONNX File" << std::endl; |
| 60 | migraphx::onnx_options options; |
| 61 | p = parse_onnx(input_file, options); |
| 62 | } |
| 63 | else if(load_arg != nullptr) |
| 64 | { |
| 65 | std::cout << "Loading Graph File" << std::endl; |
| 66 | std::string format = load_arg; |
| 67 | if(format == "json") |
| 68 | { |
| 69 | migraphx::file_options options; |
| 70 | options.set_file_format("json"); |
| 71 | p = migraphx::load(input_file, options); |
| 72 | } |
| 73 | else if(format == "msgpack") |
| 74 | { |
| 75 | migraphx::file_options options; |
| 76 | options.set_file_format("msgpack"); |
| 77 | p = migraphx::load(input_file, options); |
| 78 | } |
| 79 | else |
| 80 | p = migraphx::load(input_file); |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | std::cout << "Error: Incorrect Usage" << std::endl; |
| 85 | std::cout << "Usage: " << argv[0] << " <input_file> " |
| 86 | << "[options]" << std::endl; |
| 87 | std::cout << "options:" << std::endl; |
| 88 | std::cout << "\t--parse onnx" << std::endl; |
| 89 | std::cout << "\t--load json/msgpack" << std::endl; |
| 90 | std::cout << "\t--save <output_file>" << std::endl; |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | std::cout << "Input Graph: " << std::endl; |
nothing calls this directly
no test coverage detected