| 27 | #include "test.hpp" |
| 28 | |
| 29 | TEST_CASE(add_literals) |
| 30 | { |
| 31 | migraphx::program p; |
| 32 | migraphx::module m = p.get_main_module(); |
| 33 | migraphx::shape param_shape{migraphx_shape_float_type, {3, 3}}; |
| 34 | std::vector<float> x_values(9, 1); |
| 35 | auto x = m.add_literal(param_shape, x_values.data()); |
| 36 | std::vector<float> y_values(9, -1); |
| 37 | auto y = m.add_literal(param_shape, y_values.data()); |
| 38 | auto add_op = migraphx::operation("add"); |
| 39 | auto r = m.add_instruction(add_op, {x, y}); |
| 40 | m.add_return({r}); |
| 41 | // run on ref target |
| 42 | p.compile(migraphx::target("ref")); |
| 43 | migraphx::program_parameters pp; |
| 44 | auto outputs = p.eval(pp); |
| 45 | auto output = outputs[0]; |
| 46 | std::vector<float> expected(9, 0); |
| 47 | CHECK(output == migraphx::argument(param_shape, expected.data())); |
| 48 | } |
| 49 | |
| 50 | TEST_CASE(if_then_else_op) |
| 51 | { |
nothing calls this directly
no test coverage detected