| 33 | namespace { |
| 34 | |
| 35 | migraphx::program |
| 36 | create_program(const migraphx::shape& data_shape, int64_t sorted, std::optional<int64_t> axis) |
| 37 | { |
| 38 | migraphx::program p; |
| 39 | auto* mm = p.get_main_module(); |
| 40 | auto data = mm->add_parameter("X", data_shape); |
| 41 | auto op = axis ? migraphx::make_op("unique", {{"axis", *axis}, {"sorted", sorted}}) |
| 42 | : migraphx::make_op("unique", {{"sorted", sorted}}); |
| 43 | |
| 44 | auto r = mm->add_instruction(op, data); |
| 45 | |
| 46 | auto r0 = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 0}}), r); |
| 47 | auto r1 = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 1}}), r); |
| 48 | auto r2 = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 2}}), r); |
| 49 | auto r3 = mm->add_instruction(migraphx::make_op("get_tuple_elem", {{"index", 3}}), r); |
| 50 | mm->add_return({r0, r1, r2, r3}); |
| 51 | return p; |
| 52 | }; |
| 53 | |
| 54 | template <typename T> |
| 55 | auto run_program(T& data, |