()
| 48 | cond_shape = migraphx.shape(type="bool", lens=[1], strides=[0]) |
| 49 | |
| 50 | def create_program(): |
| 51 | p = migraphx.program() |
| 52 | mm = p.get_main_module() |
| 53 | cond = mm.add_parameter("cond", cond_shape) |
| 54 | x = mm.add_parameter("x", param_shape) |
| 55 | y = mm.add_parameter("y", param_shape) |
| 56 | then_mod = p.create_module("If_0_if") |
| 57 | x_identity = then_mod.add_instruction(migraphx.op("identity"), [x]) |
| 58 | then_mod.add_return([x_identity]) |
| 59 | |
| 60 | else_mod = p.create_module("If_0_else") |
| 61 | y_identity = else_mod.add_instruction(migraphx.op("identity"), [y]) |
| 62 | else_mod.add_return([y_identity]) |
| 63 | |
| 64 | if_ins = mm.add_instruction(migraphx.op("if"), [cond], |
| 65 | [then_mod, else_mod]) |
| 66 | ret = mm.add_instruction(migraphx.op("get_tuple_elem", **{"index": 0}), |
| 67 | [if_ins]) |
| 68 | mm.add_return([ret]) |
| 69 | return p |
| 70 | |
| 71 | params = {} |
| 72 | params["x"] = migraphx.generate_argument(param_shape) |
no test coverage detected