@@ -67,12 +67,12 @@ def export_compsite_module_with_lower_graph():
67
67
m = AddMulModule ().eval ()
68
68
m_inputs = m .get_random_inputs ()
69
69
edge = exir .capture (m , m_inputs , _CAPTURE_CONFIG ).to_edge (_EDGE_COMPILE_CONFIG )
70
- print ("Exported graph:\n " , edge .graph )
70
+ print ("Exported graph:\n " , edge .exported_program . graph )
71
71
72
72
# Lower AddMulModule to the demo backend
73
73
print ("Lowering to the demo backend..." )
74
74
lowered_graph = to_backend (
75
- BackendWithCompilerDemo .__name__ , edge , m .get_compile_spec ()
75
+ BackendWithCompilerDemo .__name__ , edge . exported_program , m .get_compile_spec ()
76
76
)
77
77
78
78
# Composite the lower graph with other module
@@ -92,9 +92,9 @@ def forward(self, *args):
92
92
).to_edge (_EDGE_COMPILE_CONFIG )
93
93
94
94
# The graph module is still runnerable
95
- composited_edge .graph_module (* m_inputs )
95
+ composited_edge .exported_program . graph_module (* m_inputs )
96
96
97
- print ("Lowered graph:\n " , composited_edge .graph )
97
+ print ("Lowered graph:\n " , composited_edge .exported_program . graph )
98
98
99
99
exec_prog = composited_edge .to_executorch ()
100
100
buffer = exec_prog .buffer
@@ -139,14 +139,14 @@ def get_random_inputs(self):
139
139
edge = exir .capture (m , m .get_random_inputs (), _CAPTURE_CONFIG ).to_edge (
140
140
_EDGE_COMPILE_CONFIG
141
141
)
142
- print ("Exported graph:\n " , edge .graph )
142
+ print ("Exported graph:\n " , edge .exported_program . graph )
143
143
144
144
# Lower to backend_with_compiler_demo
145
145
print ("Lowering to the demo backend..." )
146
- lower = to_backend (edge , AddMulPartitionerDemo )
147
- print ("Lowered graph:\n " , edge .graph )
146
+ edge . exported_program = to_backend (edge . exported_program , AddMulPartitionerDemo )
147
+ print ("Lowered graph:\n " , edge .exported_program . graph )
148
148
149
- exec_prog = lower .to_executorch ()
149
+ exec_prog = edge .to_executorch ()
150
150
buffer = exec_prog .buffer
151
151
152
152
model_name = "partition_lowered_model"
@@ -173,11 +173,13 @@ def export_and_lower_the_whole_graph():
173
173
edge = exir .capture (m , m .get_random_inputs (), _CAPTURE_CONFIG ).to_edge (
174
174
_EDGE_COMPILE_CONFIG
175
175
)
176
- print ("Exported graph:\n " , edge .graph )
176
+ print ("Exported graph:\n " , edge .exported_program . graph )
177
177
178
178
# Lower AddMulModule to the demo backend
179
179
print ("Lowering to the demo backend..." )
180
- _ = to_backend (BackendWithCompilerDemo .__name__ , edge , m .get_compile_spec ())
180
+ _ = to_backend (
181
+ BackendWithCompilerDemo .__name__ , edge .exported_program , m .get_compile_spec ()
182
+ )
181
183
182
184
# TODO(chenlai): emit the lowered graph
183
185
0 commit comments