Skip to content

Commit b7a86bd

Browse files
pytorchbottom-arm
andauthored
Arm backend: Replace module() calls with graph_module (#14538)
Using ExportedProgram.module() in later versions of torch introduce guards on the input. These guards cause an error in the ExportInterpreter which forbid the use of call_module. Fixes: #14417 Change-Id: I0cb68af9671dd1e3b543660c1cc49ff28cbffddc cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 Co-authored-by: Tom Allsop <[email protected]>
1 parent 7f201c2 commit b7a86bd

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

backends/arm/scripts/TOSA_minimal_example.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"model = Add()\n",
6363
"model = model.eval()\n",
6464
"exported_program = torch.export.export(model, example_inputs)\n",
65-
"graph_module = exported_program.module()\n",
65+
"graph_module = exported_program.graph_module\n",
6666
"\n",
6767
"_ = graph_module.print_readable()"
6868
]
@@ -201,7 +201,7 @@
201201
" config=ExecutorchBackendConfig(extract_delegate_segments=False)\n",
202202
" )\n",
203203
"\n",
204-
"executorch_program_manager.exported_program().module().print_readable()\n",
204+
"executorch_program_manager.exported_program().graph_module.print_readable()\n",
205205
"\n",
206206
"# Save pte file\n",
207207
"pte_name = base_name + \".pte\"\n",

docs/source/tutorial-arm-ethos-u.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ example_inputs = (torch.ones(1,1,1,1),torch.ones(1,1,1,1))
8585
model = Add()
8686
model = model.eval()
8787
exported_program = torch.export.export(model, example_inputs)
88-
graph_module = exported_program.module()
88+
graph_module = exported_program.graph_module
8989

9090

9191
from executorch.backends.arm.ethosu import EthosUCompileSpec

docs/source/tutorial-arm-vgf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ example_inputs = (torch.ones(1,1,1,1),torch.ones(1,1,1,1))
8989
model = Add()
9090
model = model.eval()
9191
exported_program = torch.export.export_for_training(model, example_inputs)
92-
graph_module = exported_program.module()
92+
graph_module = exported_program.graph_module
9393

9494

9595
from executorch.backends.arm.vgf import VgfCompileSpec

examples/arm/ethos_u_minimal_example.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"model = Add()\n",
5959
"model = model.eval()\n",
6060
"exported_program = torch.export.export(model, example_inputs)\n",
61-
"graph_module = exported_program.module()\n",
61+
"graph_module = exported_program.graph_module\n",
6262
"\n",
6363
"_ = graph_module.print_readable()"
6464
]
@@ -160,7 +160,7 @@
160160
" config=ExecutorchBackendConfig(extract_delegate_segments=False)\n",
161161
" )\n",
162162
"\n",
163-
"_ = executorch_program_manager.exported_program().module().print_readable()\n",
163+
"_ = executorch_program_manager.exported_program().graph_module.print_readable()\n",
164164
"\n",
165165
"# Save pte file\n",
166166
"save_pte_program(executorch_program_manager, \"ethos_u_minimal_example.pte\")"

examples/arm/vgf_minimal_example.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
"\n",
5757
"model = Add()\n",
5858
"model = model.eval()\n",
59-
"exported_program = torch.export.export_for_training(model, example_inputs)\n",
60-
"graph_module = exported_program.module()\n",
59+
"exported_program = torch.export.export(model, example_inputs)\n",
60+
"graph_module = exported_program.graph_module\n",
6161
"\n",
6262
"_ = graph_module.print_readable()"
6363
]
@@ -197,7 +197,7 @@
197197
" config=ExecutorchBackendConfig(extract_delegate_segments=False)\n",
198198
")\n",
199199
"\n",
200-
"executorch_program_manager.exported_program().module().print_readable()\n",
200+
"executorch_program_manager.exported_program().graph_module.print_readable()\n",
201201
"\n",
202202
"# Save pte file\n",
203203
"cwd_dir = os.getcwd()\n",

0 commit comments

Comments
 (0)