Skip to content

Commit baa5ec7

Browse files
authored
Add strict=True explicit flag to Executorch invocations to torch.export.export
Differential Revision: D69068797 Pull Request resolved: #8190
1 parent 3e64c4e commit baa5ec7

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

backends/qualcomm/utils/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,6 @@ def generate_multi_graph_program(
873873
backend_config: ExecutorchBackendConfig = None,
874874
constant_methods: Optional[Dict[str, Any]] = None,
875875
) -> ExecutorchProgramManager:
876-
877876
# compile multiple graphs in qcir into single context binary
878877
(
879878
graph_inputs,
@@ -1060,7 +1059,7 @@ def forward(
10601059
outputs_dict[graph_name],
10611060
embedding_quantize,
10621061
)
1063-
prog = torch.export.export(composite_llama_module, sample_inputs)
1062+
prog = torch.export.export(composite_llama_module, sample_inputs, strict=True)
10641063
progs_dict[graph_name] = prog
10651064
# leverage ExecutorchProgramManager for generating pte with multi-methods
10661065
edge_prog_mgr = to_edge(

devtools/visualization/visualization_utils_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
8484
def test_visualize_manual_export(server):
8585
with server():
8686
model = Linear(20, 30)
87-
exported_program = torch.export.export(model, model.get_inputs())
87+
exported_program = torch.export.export(model, model.get_inputs(), strict=True)
8888
visualize(exported_program)
8989
time.sleep(3.0)
9090

@@ -150,7 +150,7 @@ def test_visualize_to_executorch(server):
150150
def test_visualize_graph(server):
151151
with server():
152152
model = Linear(20, 30)
153-
exported_program = torch.export.export(model, model.get_inputs())
153+
exported_program = torch.export.export(model, model.get_inputs(), strict=True)
154154
exported_program = to_edge_transform_and_lower(
155155
exported_program
156156
).exported_program()

exir/emit/test/test_emit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def forward(self, x):
265265

266266
m = TestModule()
267267
example_inputs = (torch.ones(10),)
268-
ep = torch.export.export(m, example_inputs)
268+
ep = torch.export.export(m, example_inputs, strict=True)
269269
edge = to_edge(
270270
ep,
271271
compile_config=EdgeCompileConfig(

exir/program/test/test_program.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def forward(self, a, b, c):
343343

344344
inp = (torch.randn(10), torch.randn(10), torch.tensor(3))
345345

346-
ep = export(M(), inp)
346+
ep = export(M(), inp, strict=True)
347347
edge = to_edge(ep)
348348
self.assertTrue(
349349
torch.allclose(

extension/llm/modules/test/test_kv_cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def forward(self, k_val: torch.Tensor, v_val: torch.Tensor):
143143
3: torch.export.Dim.STATIC,
144144
},
145145
},
146+
strict=True,
146147
)
147148
return exported_kv_cache
148149

0 commit comments

Comments
 (0)