"include/vscode:/vscode.git/clone" did not exist on "a124067c05e50794e91755025f6d734a07f49336"
Commit 4ce41ebc authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent 33ce5786
...@@ -163,9 +163,9 @@ void quantize(program& prog, const std::vector<std::string>& ins_names) ...@@ -163,9 +163,9 @@ 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"}); }
static void ins_quantize_int8(program& prog, static void ins_quantize_int8(program& prog,
instruction_ref ins, instruction_ref ins,
std::vector<instruction_ref>& converted_inputs, std::vector<instruction_ref>& converted_inputs,
const std::vector<std::pair<float, float>>& ins_quant_params) const std::vector<std::pair<float, float>>& ins_quant_params)
{ {
auto orig_type = ins->get_shape().type(); auto orig_type = ins->get_shape().type();
auto inputs = ins->inputs(); auto inputs = ins->inputs();
......
...@@ -96,10 +96,10 @@ TEST_CASE(dot_large_alpha_beta_float) ...@@ -96,10 +96,10 @@ TEST_CASE(dot_large_alpha_beta_float)
// add the shift // add the shift
std::vector<float> vsa(sa.elements(), 1.0f); std::vector<float> vsa(sa.elements(), 1.0f);
auto sfta = p.add_literal(migraphx::literal(sa, vsa)); auto sfta = p.add_literal(migraphx::literal(sa, vsa));
auto msa = p.add_instruction(migraphx::op::add{}, sfta, ma); auto msa = p.add_instruction(migraphx::op::add{}, sfta, ma);
auto ra = p.add_instruction(migraphx::op::round{}, msa); auto ra = p.add_instruction(migraphx::op::round{}, msa);
auto ca = p.add_instruction(migraphx::op::clip{127.0f, -128.0f}, ra); auto ca = p.add_instruction(migraphx::op::clip{127.0f, -128.0f}, ra);
auto qa = p.add_instruction(migraphx::op::convert{migraphx::shape::int8_type}, ca); auto qa = p.add_instruction(migraphx::op::convert{migraphx::shape::int8_type}, ca);
// quantize parameter b to int8 type // quantize parameter b to int8 type
auto insert_loc = std::next(pb); auto insert_loc = std::next(pb);
...@@ -108,10 +108,12 @@ TEST_CASE(dot_large_alpha_beta_float) ...@@ -108,10 +108,12 @@ TEST_CASE(dot_large_alpha_beta_float)
auto mb = p.insert_instruction(insert_loc, migraphx::op::mul{}, fb, pb); auto mb = p.insert_instruction(insert_loc, migraphx::op::mul{}, fb, pb);
auto rb = p.insert_instruction(insert_loc, migraphx::op::round{}, mb); auto rb = p.insert_instruction(insert_loc, migraphx::op::round{}, mb);
auto cb = p.insert_instruction(insert_loc, migraphx::op::clip{127.0f, -128.0f}, rb); auto cb = p.insert_instruction(insert_loc, migraphx::op::clip{127.0f, -128.0f}, rb);
auto qb = p.insert_instruction(insert_loc, migraphx::op::convert{migraphx::shape::int8_type}, cb); auto qb =
p.insert_instruction(insert_loc, migraphx::op::convert{migraphx::shape::int8_type}, cb);
// quantize parameter b to int32 type // quantize parameter b to int32 type
auto qc = p.insert_instruction(std::next(pc), migraphx::op::convert{migraphx::shape::int32_type}, pc); auto qc = p.insert_instruction(
std::next(pc), migraphx::op::convert{migraphx::shape::int32_type}, pc);
auto qdot = p.add_instruction(migraphx::op::quant_dot{2000, 51}, qa, qb, qc); auto qdot = p.add_instruction(migraphx::op::quant_dot{2000, 51}, qa, qb, qc);
p.add_instruction(migraphx::op::convert{migraphx::shape::float_type}, qdot); p.add_instruction(migraphx::op::convert{migraphx::shape::float_type}, qdot);
...@@ -121,7 +123,8 @@ TEST_CASE(dot_large_alpha_beta_float) ...@@ -121,7 +123,8 @@ TEST_CASE(dot_large_alpha_beta_float)
auto p = create_program(); auto p = create_program();
const std::vector<std::pair<float, float>>& quant_params{{0.1f, 1.0f}, {0.1f, 0.0f}, {0.1f, 100.0f}}; const std::vector<std::pair<float, float>>& quant_params{
{0.1f, 1.0f}, {0.1f, 0.0f}, {0.1f, 100.0f}};
// default scale 64.0f is used for all args // default scale 64.0f is used for all args
migraphx::quantize_int8(p, {"dot"}, quant_params); migraphx::quantize_int8(p, {"dot"}, quant_params);
......
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