Skip to content

Commit 388d089

Browse files
gmagogsfmfacebook-github-bot
authored andcommitted
executorch/backends/apple/coreml/test (#9054)
Summary: Pull Request resolved: #9054 Differential Revision: D70575360
1 parent e6d44fa commit 388d089

File tree

9 files changed

+14
-13
lines changed

9 files changed

+14
-13
lines changed

backends/apple/coreml/test/test_coreml_partitioner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def forward(self, q, k, v, mask):
117117
v = torch.randn(batch_size, n_heads, max_seq_length, embedding_dim)
118118
mask = torch.randn(seq_len, max_seq_length)
119119
example_inputs = (q, k, v, mask)
120-
ep = torch.export.export(model, example_inputs)
120+
ep = torch.export.export(model, example_inputs, strict=True)
121121
coreml_partitioner = CoreMLPartitioner()
122122

123123
# Using to_edge_transform_and_lower, we expect SDPA will be preserved and show up in delegated graph

backends/qualcomm/_passes/decompose_any.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def call(self, graph_module: torch.fx.GraphModule) -> PassResult:
4141
keepdim = node.args[2] if len(node.args) > 2 else False
4242
model = Any(dim, keepdim)
4343
edge_mgr = to_edge(
44-
torch.export.export(model, (node.args[0].meta["val"],))
44+
torch.export.export(model, (node.args[0].meta["val"],), strict=True)
4545
)
4646
decomposed_module = edge_mgr.exported_program()
4747

backends/qualcomm/_passes/decompose_linalg_vector_norm.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ def call(self, graph_module: torch.fx.GraphModule) -> PassResult:
4646
model = LinalgVectorNorm(ord, dim, keepdim)
4747
if self.aten_dialect_capture:
4848
decomposed_module = torch.export.export(
49-
model, (node.args[0].meta["val"],)
49+
model, (node.args[0].meta["val"],), strict=True
5050
).module()
5151
else:
5252
edge_mgr = to_edge(
53-
torch.export.export(model, (node.args[0].meta["val"],))
53+
torch.export.export(
54+
model, (node.args[0].meta["val"],), strict=True
55+
)
5456
)
5557
decomposed_module = edge_mgr.exported_program()
5658

backends/qualcomm/tests/utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,9 @@ def get_qdq_module(
526526
dynamic_shapes: Dict = None,
527527
bypass_check: bool = False,
528528
) -> torch.fx.GraphModule:
529-
m = torch.export.export(module, inputs, dynamic_shapes=dynamic_shapes).module()
529+
m = torch.export.export(
530+
module, inputs, dynamic_shapes=dynamic_shapes, strict=True
531+
).module()
530532

531533
quantizer = QnnQuantizer()
532534
quantizer.add_custom_quant_annotations(custom_quant_annotations)

backends/qualcomm/utils/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def capture_program(
452452
dynamic_shapes: Dict = None,
453453
) -> exir.ExirExportedProgram:
454454
module = _preprocess_module(module, inputs)
455-
ep = torch.export.export(module, inputs, dynamic_shapes=dynamic_shapes)
455+
ep = torch.export.export(module, inputs, dynamic_shapes=dynamic_shapes, strict=True)
456456
decomposed_ep = ep.run_decompositions(get_decomp_table())
457457
core_ep = ExirExportedProgram(decomposed_ep, False)
458458
core_ep.transform(TensorI64toI32(edge_program=core_ep))

backends/transforms/test/test_rank_0_to_rank_1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def forward(self, x, y):
1717
model.eval()
1818

1919
example_inputs = (torch.tensor(1.0), torch.tensor(2.0))
20-
aten = torch.export.export(model, example_inputs)
20+
aten = torch.export.export(model, example_inputs, strict=True)
2121

2222
# Check that the input rank is 0
2323
for node in aten.graph.nodes:

examples/apple/coreml/llama/export.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,7 @@ def main() -> None:
192192
)
193193
example_inputs = input_manager.get_inputs(tokens=[0])
194194

195-
ep = torch.export.export(
196-
model,
197-
example_inputs,
198-
)
195+
ep = torch.export.export(model, example_inputs, strict=True)
199196
print("Exported program")
200197
print(ep)
201198

exir/tests/test_memory_planning.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def forward(self, input, label):
749749
net = TrainingNet(Net())
750750
inputs = (torch.randn(1, 6, 5, 5), torch.ones(1, dtype=torch.int64))
751751

752-
ep = export(net, inputs)
752+
ep = export(net, inputs, strict=True)
753753
ep = _export_forward_backward(ep)
754754
ep = to_edge(ep)
755755
ep = ep.to_executorch()

exir/verification/test/test_verifier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def forward(self, input, label):
153153
net = TrainingNet(Net())
154154
inputs = (torch.randn(1, 6, 5, 5), torch.ones(1, dtype=torch.int64))
155155

156-
export_model = export(net, inputs)
156+
export_model = export(net, inputs, strict=True)
157157
export_model = _export_forward_backward(export_model)
158158

159159
edge = to_edge(export_model)

0 commit comments

Comments
 (0)