Commit 5246b8d7 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent 4e433399
...@@ -104,9 +104,10 @@ void quantize(program& prog, const std::vector<std::string>& ins_names) ...@@ -104,9 +104,10 @@ void quantize(program& prog, const std::vector<std::string>& ins_names)
void quantize(program& prog) { quantize(prog, {"all"}); } void quantize(program& prog) { quantize(prog, {"all"}); }
std::vector<std::vector<argument> > ins_args; std::vector<std::vector<argument>> ins_args;
void capture_args(std::size_t ins_index, std::vector<argument> args) { void capture_args(std::size_t ins_index, std::vector<argument> args)
if (ins_index = ins_args.size()) {
if(ins_index = ins_args.size())
{ {
ins_args.push_back(std::vector<argument>{}); ins_args.push_back(std::vector<argument>{});
} }
...@@ -115,7 +116,8 @@ void capture_args(std::size_t ins_index, std::vector<argument> args) { ...@@ -115,7 +116,8 @@ void capture_args(std::size_t ins_index, std::vector<argument> args) {
return; return;
} }
void calc_quant_params(std::vector<std::vector<argument>>&ins_arg, std::vector<std::pair<float, float>>& ins_params) void calc_quant_params(std::vector<std::vector<argument>>& ins_arg,
std::vector<std::pair<float, float>>& ins_params)
{ {
return; return;
} }
...@@ -126,9 +128,9 @@ void capture_arguments(program& prog, const std::vector<std::string>& ins_names) ...@@ -126,9 +128,9 @@ void capture_arguments(program& prog, const std::vector<std::string>& ins_names)
{ {
// the int8 quantization only support dot and convolution // the int8 quantization only support dot and convolution
std::vector<std::string> op_names = {"dot", "convolution"}; std::vector<std::string> op_names = {"dot", "convolution"};
if (!std::all_of(ins_names.begin(), ins_names.end(), [&](auto name) { if(!std::all_of(ins_names.begin(), ins_names.end(), [&](auto name) {
return std::find(op_names.begin(), op_names.end(), name) != op_names.end(); return std::find(op_names.begin(), op_names.end(), name) != op_names.end();
})) }))
{ {
MIGRAPHX_THROW("CAPTURE_ARGUMENTS: input operator is not supported"); MIGRAPHX_THROW("CAPTURE_ARGUMENTS: input operator is not supported");
} }
...@@ -137,23 +139,24 @@ void capture_arguments(program& prog, const std::vector<std::string>& ins_names) ...@@ -137,23 +139,24 @@ void capture_arguments(program& prog, const std::vector<std::string>& ins_names)
std::size_t index = 0; std::size_t index = 0;
for(auto ins : iterator_for(prog)) for(auto ins : iterator_for(prog))
{ {
if (not contains(ins_names, ins->name())) if(not contains(ins_names, ins->name()))
{ {
continue; continue;
} }
auto inputs = ins->inputs(); auto inputs = ins->inputs();
std::vector<instruction_ref> new_args; std::vector<instruction_ref> new_args;
for (auto input : inputs) for(auto input : inputs)
{ {
instruction_ref new_ins{}; instruction_ref new_ins{};
if (ins_map.count(input) > 0) if(ins_map.count(input) > 0)
{ {
new_ins = ins_map[input]; new_ins = ins_map[input];
} }
else else
{ {
new_ins = prog.insert_instruction(std::next(input), op::capture{index++, capture_args}, input); new_ins = prog.insert_instruction(
std::next(input), op::capture{index++, capture_args}, input);
ins_map[input] = new_ins; ins_map[input] = new_ins;
} }
new_args.push_back(new_ins); new_args.push_back(new_ins);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment