Commit 377021cd authored by Shucai Xiao's avatar Shucai Xiao
Browse files

clang format

parent 343c4cac
...@@ -297,7 +297,8 @@ TEST_CASE(dot_float) ...@@ -297,7 +297,8 @@ TEST_CASE(dot_float)
p.insert_instruction(insert_loc, migraphx::op::convert{migraphx::shape::int8_type}, cb); p.insert_instruction(insert_loc, migraphx::op::convert{migraphx::shape::int8_type}, cb);
// quantize parameter c to int32 type // quantize parameter c 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{1, 0}, qa, qb); auto qdot = p.add_instruction(migraphx::op::quant_dot{1, 0}, qa, qb);
auto fdot = p.add_instruction(migraphx::op::convert{migraphx::shape::float_type}, qdot); auto fdot = p.add_instruction(migraphx::op::convert{migraphx::shape::float_type}, qdot);
...@@ -353,7 +354,8 @@ TEST_CASE(dot_double_2args) ...@@ -353,7 +354,8 @@ TEST_CASE(dot_double_2args)
// quantize parameter b to int8 type // quantize parameter b to int8 type
auto insert_loc = std::next(pb); auto insert_loc = std::next(pb);
auto fpb = p.insert_instruction(insert_loc, migraphx::op::convert{migraphx::shape::float_type}, pb); auto fpb = p.insert_instruction(
insert_loc, migraphx::op::convert{migraphx::shape::float_type}, pb);
std::vector<float> vfb(sb.elements(), 0.1f); std::vector<float> vfb(sb.elements(), 0.1f);
auto fb = p.add_literal(migraphx::literal({migraphx::shape::float_type, sb.lens()}, vfb)); auto fb = p.add_literal(migraphx::literal({migraphx::shape::float_type, sb.lens()}, vfb));
auto mb = p.insert_instruction(insert_loc, migraphx::op::mul{}, fb, fpb); auto mb = p.insert_instruction(insert_loc, migraphx::op::mul{}, fb, fpb);
...@@ -373,8 +375,7 @@ TEST_CASE(dot_double_2args) ...@@ -373,8 +375,7 @@ TEST_CASE(dot_double_2args)
}; };
auto p = create_program(); auto p = create_program();
const std::vector<std::pair<float, float>>& quant_params{ const std::vector<std::pair<float, float>>& quant_params{{0.1f, 0.0f}, {0.1f, 0.0f}};
{0.1f, 0.0f}, {0.1f, 0.0f}};
migraphx::quantize_int8(p, {"dot"}, quant_params); migraphx::quantize_int8(p, {"dot"}, quant_params);
auto qp = create_int8_quantized_prog(); auto qp = create_int8_quantized_prog();
...@@ -488,7 +489,8 @@ TEST_CASE(dot_large_alpha_beta_int32) ...@@ -488,7 +489,8 @@ TEST_CASE(dot_large_alpha_beta_int32)
auto insert_loc = std::next(pb); auto insert_loc = std::next(pb);
std::vector<float> vfb(sb.elements(), 0.1f); std::vector<float> vfb(sb.elements(), 0.1f);
auto fb = p.add_literal(migraphx::literal({migraphx::shape::float_type, sb.lens()}, vfb)); auto fb = p.add_literal(migraphx::literal({migraphx::shape::float_type, sb.lens()}, vfb));
auto conv_b = p.insert_instruction(insert_loc, migraphx::op::convert{migraphx::shape::float_type}, pb); auto conv_b = p.insert_instruction(
insert_loc, migraphx::op::convert{migraphx::shape::float_type}, pb);
auto mb = p.insert_instruction(insert_loc, migraphx::op::mul{}, fb, conv_b); auto mb = p.insert_instruction(insert_loc, migraphx::op::mul{}, fb, conv_b);
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);
...@@ -501,14 +503,14 @@ TEST_CASE(dot_large_alpha_beta_int32) ...@@ -501,14 +503,14 @@ TEST_CASE(dot_large_alpha_beta_int32)
}; };
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}};
migraphx::quantize_int8(p, {"dot"}, quant_params); migraphx::quantize_int8(p, {"dot"}, quant_params);
auto qp = create_int8_quantized_prog(); auto qp = create_int8_quantized_prog();
EXPECT(p == qp); EXPECT(p == qp);
} }
TEST_CASE(dot_int32) TEST_CASE(dot_int32)
{ {
auto create_program = [] { auto create_program = [] {
...@@ -551,7 +553,8 @@ TEST_CASE(dot_int32) ...@@ -551,7 +553,8 @@ TEST_CASE(dot_int32)
auto insert_loc = std::next(pb); auto insert_loc = std::next(pb);
std::vector<float> vfb(sb.elements(), 0.1f); std::vector<float> vfb(sb.elements(), 0.1f);
auto fb = p.add_literal(migraphx::literal({migraphx::shape::float_type, sb.lens()}, vfb)); auto fb = p.add_literal(migraphx::literal({migraphx::shape::float_type, sb.lens()}, vfb));
auto conv_b = p.insert_instruction(insert_loc, migraphx::op::convert{migraphx::shape::float_type}, pb); auto conv_b = p.insert_instruction(
insert_loc, migraphx::op::convert{migraphx::shape::float_type}, pb);
auto mb = p.insert_instruction(insert_loc, migraphx::op::mul{}, fb, conv_b); auto mb = p.insert_instruction(insert_loc, migraphx::op::mul{}, fb, conv_b);
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);
...@@ -574,7 +577,8 @@ TEST_CASE(dot_int32) ...@@ -574,7 +577,8 @@ TEST_CASE(dot_int32)
}; };
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}};
migraphx::quantize_int8(p, {"dot"}, quant_params); migraphx::quantize_int8(p, {"dot"}, quant_params);
auto qp = create_int8_quantized_prog(); auto qp = create_int8_quantized_prog();
......
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