Skip to content

Commit bf88b3c

Browse files
guangy10facebook-github-bot
authored andcommitted
Prohibit customize export config (#337)
Summary: More cleanup in `executorch/examples`. `_unlift` flag is removed for all models and all use-cases in examples, we can push to use canonical export config one step further. Not in this diff but `enable_aot` will be removed later together with `exir.capture()` Reviewed By: digantdesai Differential Revision: D49258936
1 parent 767e965 commit bf88b3c

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

examples/backend/xnnpack_examples.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import torch._export as export
1313

1414
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
15-
from executorch.exir import CaptureConfig, EdgeCompileConfig
15+
from executorch.exir import EdgeCompileConfig
1616
from executorch.exir.backend.backend_api import to_backend
1717

1818
from ..export.utils import export_to_edge, save_pte_program
@@ -82,7 +82,6 @@
8282
edge = export_to_edge(
8383
model,
8484
example_inputs,
85-
capture_config=CaptureConfig(enable_aot=True),
8685
edge_compile_config=EdgeCompileConfig(
8786
_check_ir_validity=False if args.quantize else True,
8887
),

examples/export/utils.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
from executorch.exir.tracer import Value
1717

1818

19-
_CAPTURE_CONFIG = exir.CaptureConfig(enable_aot=True)
20-
21-
# TODO(T163721729): Enable IR check after decomposing div.Tensor_mode
2219
_EDGE_COMPILE_CONFIG = exir.EdgeCompileConfig(
2320
_check_ir_validity=False,
2421
)
@@ -27,14 +24,15 @@
2724
def _to_core_aten(
2825
model: torch.fx.GraphModule,
2926
example_inputs: Tuple[Value, ...],
30-
capture_config=_CAPTURE_CONFIG,
3127
) -> ExirExportedProgram:
3228
# post autograd export. eventually this will become .to_core_aten
3329
if not isinstance(model, torch.fx.GraphModule):
3430
raise ValueError(
3531
f"Expected passed in model to be an instance of fx.GraphModule, got {type(model)}"
3632
)
37-
core_aten_exir_ep = exir.capture(model, example_inputs, capture_config)
33+
core_aten_exir_ep = exir.capture(
34+
model, example_inputs, exir.CaptureConfig(enable_aot=True)
35+
)
3836
logging.info(f"Core ATen graph:\n{core_aten_exir_ep.exported_program.graph}")
3937
return core_aten_exir_ep
4038

@@ -51,17 +49,15 @@ def _core_aten_to_edge(
5149
def export_to_edge(
5250
model: torch.fx.GraphModule,
5351
example_inputs: Tuple[Value, ...],
54-
capture_config=_CAPTURE_CONFIG,
5552
edge_compile_config=_EDGE_COMPILE_CONFIG,
5653
) -> ExirExportedProgram:
57-
core_aten_exir_ep = _to_core_aten(model, example_inputs, capture_config)
54+
core_aten_exir_ep = _to_core_aten(model, example_inputs)
5855
return _core_aten_to_edge(core_aten_exir_ep, edge_compile_config)
5956

6057

6158
def export_to_exec_prog(
6259
model,
6360
example_inputs,
64-
capture_config=_CAPTURE_CONFIG,
6561
edge_compile_config=_EDGE_COMPILE_CONFIG,
6662
backend_config=None,
6763
):

0 commit comments

Comments
 (0)