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

Function TEST_CASE

test/ref/quantizelinear.cpp:34–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32#include <test.hpp>
33
34TEST_CASE(quantizelinear_1)
35{
36 migraphx::shape xs{migraphx::shape::float_type, {2, 3, 3}};
37 std::vector<float> xv = {
38 -300, 600, 129, -1000, 4, 3, -6, 600, 550, -300, 600, 129, -1000, 4, 3, -6, 600, 550};
39 migraphx::shape ss{migraphx::shape::float_type, {2, 3, 3}};
40 std::vector<float> sv = {2, 2, 2, 4, 4, 4, 6, 6, 6, 2, 2, 2, 4, 4, 4, 6, 6, 6};
41 migraphx::shape zs{migraphx::shape::int8_type, {2, 3, 3}};
42 std::vector<uint8_t> zv = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
43 auto create_program = [&]() {
44 migraphx::program p;
45 auto* mm = p.get_main_module();
46 auto x = mm->add_literal(xs, xv);
47 auto s = mm->add_literal(ss, sv);
48 auto z = mm->add_literal(zs, zv);
49 mm->add_instruction(migraphx::make_op("quantizelinear"), x, s, z);
50 return p;
51 };
52
53 migraphx::program p1 = create_program();
54 p1.compile(migraphx::make_target("ref"));
55 auto result = p1.eval({}).back();
56 std::vector<float> results_vector(18);
57 result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
58 std::vector<float> gold{
59 -128, 127, 64, -128, 1, 1, -1, 100, 92, -128, 127, 64, -128, 1, 1, -1, 100, 92};
60 EXPECT(results_vector == gold);
61}
62
63TEST_CASE(quantizelinear_2)
64{

Callers

nothing calls this directly

Calls 13

make_targetFunction · 0.85
get_main_moduleMethod · 0.80
backMethod · 0.80
create_programFunction · 0.70
make_opFunction · 0.50
add_literalMethod · 0.45
add_instructionMethod · 0.45
compileMethod · 0.45
evalMethod · 0.45
visitMethod · 0.45
assignMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected