| 28 | #include <migraphx/make_op.hpp> |
| 29 | |
| 30 | static void run_prog(migraphx::program p, |
| 31 | const migraphx::target& t, |
| 32 | migraphx::parameter_map& m_in, |
| 33 | std::vector<float>& res) |
| 34 | { |
| 35 | p.compile(t); |
| 36 | migraphx::parameter_map m; |
| 37 | for(auto&& x : p.get_parameter_shapes()) |
| 38 | { |
| 39 | if(m_in.count(x.first) > 0) |
| 40 | { |
| 41 | m[x.first] = t.copy_to(m_in[x.first]); |
| 42 | } |
| 43 | else |
| 44 | { |
| 45 | m[x.first] = t.allocate(x.second); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | auto result = t.copy_from(p.eval(m).back()); |
| 50 | result.visit([&](auto v) { res.assign(v.begin(), v.end()); }); |
| 51 | } |
| 52 | |
| 53 | // This test ensures that the codegen path doesn't round up literals, |
| 54 | // otherwise there are accuracy differences compared to ref. |