MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / TEST_CASE

Function TEST_CASE

test/rewrite_quantization_test.cpp:70–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70TEST_CASE(quantizelinear)
71{
72
73 migraphx::shape xs{migraphx::shape::float_type, {1, 3, 3}};
74 std::vector<float> xv = {-300, 200, 129, 1, 2, 3, 500, 1000, 50};
75 migraphx::shape ss{migraphx::shape::float_type, {1, 3, 3}};
76 std::vector<float> sv = {2, 2, 2, 2, 2, 2, 2, 2, 2};
77 auto create_program = [&]() {
78 migraphx::program p;
79 auto* mm = p.get_main_module();
80 auto x = mm->add_literal(xs, xv);
81 auto s = mm->add_literal(ss, sv);
82 mm->add_instruction(migraphx::make_op("quantizelinear"), x, s);
83 return p;
84 };
85
86 migraphx::program p1 = create_program();
87 migraphx::program p2 = create_program();
88
89 run_pass(*p2.get_main_module());
90 EXPECT(eval(p1) == eval(p2));
91 EXPECT(any_of(*p1.get_main_module(), &is_quantizelinear));
92 EXPECT(none_of(*p2.get_main_module(), &is_quantizelinear));
93 // ensure clip literals created in quantized program are scalar
94 // unless CK workarounds are enabled
95 if(migraphx::enabled(MIGRAPHX_ENABLE_CK_WORKAROUNDS{}))
96 EXPECT(none_of(*p2.get_main_module(), &is_clip_scalar));
97 else
98 EXPECT(any_of(*p2.get_main_module(), &is_clip_scalar));
99}
100
101TEST_CASE(dequantizelinear)
102{

Callers

nothing calls this directly

Calls 15

get_main_moduleMethod · 0.80
lensMethod · 0.80
run_passFunction · 0.70
evalFunction · 0.70
make_opFunction · 0.50
create_programFunction · 0.50
any_ofFunction · 0.50
none_ofFunction · 0.50
enabledFunction · 0.50
transformFunction · 0.50
add_literalMethod · 0.45
add_instructionMethod · 0.45

Tested by

no test coverage detected