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

Function TEST_CASE

test/ref/dequantizelinear.cpp:33–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include <test.hpp>
32
33TEST_CASE(dequantizelinear_unsigned_int8)
34
35{ /*uint8*/
36 migraphx::shape xs{migraphx::shape::uint8_type, {1, 3, 3}};
37 std::vector<uint8_t> xv = {0, 1, 2, 5, 10, 50, 100, 150, 250};
38 migraphx::shape ss{migraphx::shape::float_type, {1, 3, 3}};
39 std::vector<float> sv = {2, 2, 2, 2, 2, 2, 2, 2, 2};
40 migraphx::shape zs{migraphx::shape::uint8_type, {1, 3, 3}};
41 std::vector<uint8_t> zv = {0, 0, 0, 0, 0, 0, 0, 0, 0};
42 auto create_program = [&]() {
43 migraphx::program p;
44 auto* mm = p.get_main_module();
45 auto x = mm->add_literal(xs, xv);
46 auto s = mm->add_literal(ss, sv);
47 auto z = mm->add_literal(zs, zv);
48 mm->add_instruction(migraphx::make_op("dequantizelinear"), x, s, z);
49 return p;
50 };
51
52 migraphx::program p1 = create_program();
53 p1.compile(migraphx::make_target("ref"));
54 auto result = p1.eval({}).back();
55 std::vector<float> results_vector(9);
56 result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
57 std::vector<float> gold{0, 2, 4, 10, 20, 100, 200, 300, 500};
58 EXPECT(results_vector == gold);
59}
60
61TEST_CASE(dequantizelinear_signed_int8)
62{ /*int8*/

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