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

Function TEST_CASE

test/rewrite_pooling_test.cpp:48–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48TEST_CASE(rewrite_pooling_test)
49{
50 migraphx::shape s{migraphx::shape::float_type, {2, 2, 3, 4, 5}};
51 auto pooling_program = [&](const migraphx::op::pooling_mode mode) {
52 migraphx::module m;
53 auto input = m.add_parameter("x", s);
54 auto ret = m.add_instruction(migraphx::make_op("pooling",
55 {{"mode", mode},
56 {"padding", {0, 0, 0}},
57 {"stride", {1, 1, 1}},
58 {"lengths", {3, 4, 5}},
59 {"dilations", {1, 1, 1}}}),
60 input);
61 m.add_return({ret});
62 return m;
63 };
64
65 auto opt_program = [&](const migraphx::operation& reduce_op) {
66 migraphx::module m;
67 auto input = m.add_parameter("x", s);
68 auto rdm = m.add_instruction(reduce_op, input);
69 m.add_return({rdm});
70 return m;
71 };
72
73 auto test_rewrite = [&](const migraphx::op::pooling_mode mode, const migraphx::operation& op) {
74 migraphx::module m1 = pooling_program(mode);
75 migraphx::module m2 = opt_program(op);
76 opt_pooling(m1);
77 EXPECT(m1 == m2);
78 };
79
80 test_rewrite(migraphx::op::pooling_mode::average,
81 migraphx::make_op("reduce_mean", {{"axes", {2, 3, 4}}}));
82 test_rewrite(migraphx::op::pooling_mode::max,
83 migraphx::make_op("reduce_max", {{"axes", {2, 3, 4}}}));
84}
85
86TEST_CASE(rewrite_pooling_dialtions_test)
87{

Callers

nothing calls this directly

Calls 15

opt_poolingFunction · 0.85
make_targetFunction · 0.85
verify_rms_rangeFunction · 0.85
iotaFunction · 0.85
visit_allFunction · 0.85
add_parameterMethod · 0.80
lensMethod · 0.80
get_main_moduleMethod · 0.80
backMethod · 0.80
make_opFunction · 0.50
lowestClass · 0.50
literalClass · 0.50

Tested by

no test coverage detected