Dump IR for given arguments.
Call example: $ ./build/compiler/encodump/encodump \ –frontend build/compiler/enco/frontend/caffe/libenco_caffe_frontend.so \ –frontend-arg build/compiler/enco/test/caffe/Convolution_003.prototxt \ –frontend-arg build/compiler/enco/test/caffe/Convolution_003.caffemodel
GROUP "/" ㄴGROUP "name" ㄴATTRIBUTE "0" ㄴDATA (0): "input_01:0" ㄴATTRIBUTE "1" ㄴDATA (0): "input_02:0" ㄴGROUP "value" ㄴDATASET "0" ㄴDATA ... ㄴDATASET "1" ㄴDATA ...
54{
56
58
59 arser.add_argument(
"--first_model").required(
true).help(
"First input model filepath");
60
61 arser.add_argument(
"--second_model").required(
true).help(
"Second input model filepath");
62
63 arser.add_argument(
"--first_input_data")
64 .help("Input data filepath for the first model. If not given, circle-eval-diff will run with "
65 "randomly generated data");
66
67 arser.add_argument(
"--second_input_data")
68 .help("Input data filepath for the second model. If not given, circle-eval-diff will run with "
69 "randomly generated data");
70
71 arser.add_argument(
"--dump_output_with_prefix")
72 .help("Dump output to files. <prefix> should be given as an argument. "
73 "Outputs are saved in <prefix>.<data_index>.first.output<output_index> and "
74 "<prefix>.<data_index>.second.output<output_index>.");
75
76 arser.add_argument(
"--print_mae").nargs(0).default_value(
false).help(
"Print Mean Absolute Error");
77
78 arser.add_argument(
"--print_mape")
79 .nargs(0)
80 .default_value(false)
81 .help("Print Mean Absolute PercentageError");
82
83 arser.add_argument(
"--print_mpeir")
84 .nargs(0)
85 .default_value(false)
86 .help("Print Mean Peak Error to Interval Ratio");
87
88 arser.add_argument(
"--print_top1_match")
89 .nargs(0)
90 .default_value(false)
91 .help("Print Mean Top-1 Match Ratio");
92
93 arser.add_argument(
"--print_top5_match")
94 .nargs(0)
95 .default_value(false)
96 .help("Print Mean Top-5 Match Ratio");
97
98 arser.add_argument(
"--print_mse").nargs(0).default_value(
false).help(
"Print Mean Squared Error");
99
100 arser.add_argument(
"--input_data_format")
101 .default_value("h5")
102 .help("Input data format. h5/hdf5 (default) or directory");
103
104 try
105 {
106 arser.parse(argc, argv);
107 }
108 catch (const std::runtime_error &err)
109 {
110 std::cout << err.what() << std::endl;
112 return 255;
113 }
114
115 const auto first_model_path =
arser.get<std::string>(
"--first_model");
116 const auto second_model_path =
arser.get<std::string>(
"--second_model");
117
118
119 std::string first_input_data_path;
120 std::string second_input_data_path;
121 std::string metric;
122 std::string input_data_format;
123 std::string output_prefix;
124
125 if (
arser[
"--first_input_data"])
126 first_input_data_path =
arser.get<std::string>(
"--first_input_data");
127
128 if (
arser[
"--second_input_data"])
129 second_input_data_path =
arser.get<std::string>(
"--second_input_data");
130
131 if (
arser[
"--first_input_data"] !=
arser[
"--second_input_data"])
132 throw std::runtime_error("Input data path should be given for both first_model and "
133 "second_model, or neither must be given.");
134
135 if (
arser[
"--dump_output_with_prefix"])
136 output_prefix =
arser.get<std::string>(
"--dump_output_with_prefix");
137
138
139 std::vector<Metric> metrics;
140 if (
arser[
"--print_mae"] and
arser.get<
bool>(
"--print_mae"))
141 {
142 metrics.emplace_back(Metric::MAE);
143 }
144 if (
arser[
"--print_mape"] and
arser.get<
bool>(
"--print_mape"))
145 {
146 metrics.emplace_back(Metric::MAPE);
147 }
148 if (
arser[
"--print_mpeir"] and
arser.get<
bool>(
"--print_mpeir"))
149 {
150 metrics.emplace_back(Metric::MPEIR);
151 }
152 if (
arser[
"--print_top1_match"] and
arser.get<
bool>(
"--print_top1_match"))
153 {
154 metrics.emplace_back(Metric::MTOP1);
155 }
156 if (
arser[
"--print_top5_match"] and
arser.get<
bool>(
"--print_top5_match"))
157 {
158 metrics.emplace_back(Metric::MTOP5);
159 }
160 if (
arser[
"--print_mse"] and
arser.get<
bool>(
"--print_mse"))
161 {
162 metrics.emplace_back(Metric::MSE);
163 }
164
165 input_data_format =
arser.get<std::string>(
"--input_data_format");
166
167 auto ctx = std::make_unique<CircleEvalDiff::Context>();
168 {
169 ctx->first_model_path = first_model_path;
170 ctx->second_model_path = second_model_path;
171 ctx->first_input_data_path = first_input_data_path;
172 ctx->second_input_data_path = second_input_data_path;
173 ctx->metric = metrics;
174 ctx->input_format = to_input_format(input_data_format);
175 ctx->output_prefix = output_prefix;
176 }
177
179
180 ced.init();
181
182 ced.evalDiff();
183
184 return EXIT_SUCCESS;
185}
static void add_version(Arser &arser, const std::function< void(void)> &func)