|
21 | 21 |
|
22 | 22 | import torch |
23 | 23 | from executorch.backends.aoti.aoti_partitioner import AotiPartitioner |
24 | | -from executorch.exir import to_edge |
| 24 | +from executorch.exir import to_edge_transform_and_lower |
25 | 25 | from torch import nn |
26 | 26 | from torch.export import export |
27 | 27 | from torchvision import models |
@@ -135,13 +135,17 @@ def export_model(model, example_inputs, output_filename="aoti_model.pte"): |
135 | 135 | aten_dialect = export(model, example_inputs) |
136 | 136 |
|
137 | 137 | # 2. to_edge: Make optimizations for Edge devices |
138 | | - print("Step 2: Converting to Edge program...") |
139 | | - edge_program = to_edge(aten_dialect) |
140 | | - print(edge_program.exported_program().graph.print_tabular()) |
| 138 | + # print("Step 2: Converting to Edge program...") |
| 139 | + # edge_program = to_edge(aten_dialect) |
| 140 | + # print(edge_program.exported_program().graph.print_tabular()) |
141 | 141 |
|
142 | | - print("Step 3: Converting to backend...") |
143 | | - edge_program = edge_program.to_backend(AotiPartitioner([])) |
144 | | - print("To backend done.") |
| 142 | + # print("Step 3: Converting to backend...") |
| 143 | + # edge_program = edge_program.to_backend(AotiPartitioner([])) |
| 144 | + # print("To backend done.") |
| 145 | + |
| 146 | + edge_program = to_edge_transform_and_lower( |
| 147 | + aten_dialect, partitioner=[AotiPartitioner([])] |
| 148 | + ) |
145 | 149 |
|
146 | 150 | # 3. to_executorch: Convert the graph to an ExecuTorch program |
147 | 151 | print("Step 4: Converting to ExecuTorch program...") |
|
0 commit comments