MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / create_program

Function create_program

test/py/test_module_construct.py:50–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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)

Callers 1

run_progFunction · 0.70

Calls 7

programMethod · 0.80
get_main_moduleMethod · 0.80
add_parameterMethod · 0.80
create_moduleMethod · 0.45
add_instructionMethod · 0.45
opMethod · 0.45
add_returnMethod · 0.45

Tested by

no test coverage detected