Skip to content

Prohibit customize export config #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/backend/xnnpack_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import torch._export as export

from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
from executorch.exir import CaptureConfig, EdgeCompileConfig
from executorch.exir import EdgeCompileConfig
from executorch.exir.backend.backend_api import to_backend

from ..export.utils import export_to_edge, save_pte_program
Expand Down Expand Up @@ -82,7 +82,6 @@
edge = export_to_edge(
model,
example_inputs,
capture_config=CaptureConfig(enable_aot=True),
edge_compile_config=EdgeCompileConfig(
_check_ir_validity=False if args.quantize else True,
),
Expand Down
12 changes: 4 additions & 8 deletions examples/export/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
from executorch.exir.tracer import Value


_CAPTURE_CONFIG = exir.CaptureConfig(enable_aot=True)

# TODO(T163721729): Enable IR check after decomposing div.Tensor_mode
_EDGE_COMPILE_CONFIG = exir.EdgeCompileConfig(
_check_ir_validity=False,
)
Expand All @@ -27,14 +24,15 @@
def _to_core_aten(
model: torch.fx.GraphModule,
example_inputs: Tuple[Value, ...],
capture_config=_CAPTURE_CONFIG,
) -> ExirExportedProgram:
# post autograd export. eventually this will become .to_core_aten
if not isinstance(model, torch.fx.GraphModule):
raise ValueError(
f"Expected passed in model to be an instance of fx.GraphModule, got {type(model)}"
)
core_aten_exir_ep = exir.capture(model, example_inputs, capture_config)
core_aten_exir_ep = exir.capture(
model, example_inputs, exir.CaptureConfig(enable_aot=True)
)
logging.info(f"Core ATen graph:\n{core_aten_exir_ep.exported_program.graph}")
return core_aten_exir_ep

Expand All @@ -51,17 +49,15 @@ def _core_aten_to_edge(
def export_to_edge(
model: torch.fx.GraphModule,
example_inputs: Tuple[Value, ...],
capture_config=_CAPTURE_CONFIG,
edge_compile_config=_EDGE_COMPILE_CONFIG,
) -> ExirExportedProgram:
core_aten_exir_ep = _to_core_aten(model, example_inputs, capture_config)
core_aten_exir_ep = _to_core_aten(model, example_inputs)
return _core_aten_to_edge(core_aten_exir_ep, edge_compile_config)


def export_to_exec_prog(
model,
example_inputs,
capture_config=_CAPTURE_CONFIG,
edge_compile_config=_EDGE_COMPILE_CONFIG,
backend_config=None,
):
Expand Down