| 2906 | } |
| 2907 | |
| 2908 | static void test_dot_horiz(migraphx::shape::type_t type, const std::string& dot_type) |
| 2909 | { |
| 2910 | auto s = migraphx::shape{type, {3, 2, 2}}; |
| 2911 | migraphx::module m1; |
| 2912 | { |
| 2913 | auto input = m1.add_parameter("input", s); |
| 2914 | auto a = m1.add_literal(migraphx::generate_literal(s, 0)); |
| 2915 | auto b = m1.add_literal(migraphx::generate_literal(s, 1)); |
| 2916 | auto x = m1.add_instruction(migraphx::make_op(dot_type), input, a); |
| 2917 | auto y = m1.add_instruction(migraphx::make_op(dot_type), input, b); |
| 2918 | auto sum = m1.add_instruction(migraphx::make_op("add"), x, y); |
| 2919 | m1.add_instruction(pass_op{}, sum); |
| 2920 | } |
| 2921 | run_pass(m1); |
| 2922 | |
| 2923 | migraphx::module m2; |
| 2924 | { |
| 2925 | auto input = m2.add_parameter("input", s); |
| 2926 | auto a = m2.add_literal(migraphx::generate_literal(s, 0)); |
| 2927 | auto b = m2.add_literal(migraphx::generate_literal(s, 1)); |
| 2928 | auto concat = m2.add_instruction(migraphx::make_op("concat", {{"axis", 2}}), a, b); |
| 2929 | auto dot = m2.add_instruction(migraphx::make_op(dot_type), input, concat); |
| 2930 | auto x = m2.add_instruction( |
| 2931 | migraphx::make_op("slice", {{"axes", {2}}, {"starts", {0}}, {"ends", {2}}}), dot); |
| 2932 | auto y = m2.add_instruction( |
| 2933 | migraphx::make_op("slice", {{"axes", {2}}, {"starts", {2}}, {"ends", {4}}}), dot); |
| 2934 | auto sum = m2.add_instruction(migraphx::make_op("add"), x, y); |
| 2935 | m2.add_instruction(pass_op{}, sum); |
| 2936 | } |
| 2937 | EXPECT(m1.sort() == m2.sort()); |
| 2938 | } |
| 2939 | |
| 2940 | TEST_CASE(simplify_dot_horiz) { test_dot_horiz(migraphx::shape::int32_type, "dot"); } |
| 2941 |
no test coverage detected