| 31 | #include <test.hpp> |
| 32 | |
| 33 | TEST_CASE(pointwise_test) |
| 34 | { |
| 35 | migraphx::program p; |
| 36 | auto* mm = p.get_main_module(); |
| 37 | migraphx::shape s{migraphx::shape::float_type, {3}}; |
| 38 | auto l1 = mm->add_literal(migraphx::literal{s, {-1, 0, 1}}); |
| 39 | auto l2 = mm->add_literal(migraphx::literal{s, {1, 2, 3}}); |
| 40 | auto* pm = p.create_module("pointwise"); |
| 41 | { |
| 42 | auto x1 = pm->add_parameter("x1", {migraphx::shape::float_type}); |
| 43 | auto x2 = pm->add_parameter("x2", {migraphx::shape::float_type}); |
| 44 | auto add = pm->add_instruction(migraphx::make_op("add"), x1, x2); |
| 45 | pm->add_return({add}); |
| 46 | } |
| 47 | mm->add_instruction(migraphx::make_op("pointwise"), {l1, l2}, {pm}); |
| 48 | p.compile(migraphx::make_target("ref")); |
| 49 | auto result = p.eval({}).back(); |
| 50 | std::vector<float> results_vector(3); |
| 51 | result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); }); |
| 52 | std::vector<float> gold = {0, 2, 4}; |
| 53 | EXPECT(migraphx::verify::verify_rms_range(results_vector, gold)); |
| 54 | } |
| 55 | |
| 56 | TEST_CASE(pointwise_multi_out_test) |
| 57 | { |
nothing calls this directly
no test coverage detected