Skip to content

Commit 39d53d9

Browse files
angelayifacebook-github-bot
authored andcommitted
Fix ._transform naming (#162)
Summary: Pull Request resolved: #162 Reviewed By: manuelcandales Differential Revision: D48784931
1 parent 9ca4ed0 commit 39d53d9

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

exir/capture/_capture.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from executorch.exir.capture._config import CaptureConfig
1616
from executorch.exir.error import ExportError, ExportErrorType, InternalError
1717
from executorch.exir.program import ExirExportedProgram, MultiMethodExirExportedProgram
18-
from executorch.exir.program._program import transform_exported_program
1918
from executorch.exir.tracer import (
2019
_default_decomposition_table,
2120
dispatch_trace,
@@ -83,7 +82,7 @@ def capture(
8382
# TODO remove this later
8483
with patch("torch._export.DECOMP_TABLE", _default_decomposition_table()):
8584
ep = export(f, args, constraints=constraints)
86-
ep = transform_exported_program(ep, ReplaceViewOpsWithViewCopyOpsPass())
85+
ep = ep._transform(ReplaceViewOpsWithViewCopyOpsPass())
8786
if not config._unlift:
8887
return ExirExportedProgram(ep, False)
8988
graph_module = ep.module()

exir/lowered_backend_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def program(self, emit_stacktrace: bool = False) -> Program:
242242
equality_constraints=lowered_exported_program.equality_constraints,
243243
module_call_graph=lowered_exported_program.module_call_graph,
244244
)
245-
exported_program = exported_program.transform(
245+
exported_program = exported_program._transform(
246246
SpecPropPass(), MemoryPlanningPass("greedy")
247247
)
248248
emitted_program = emit_program(

exir/program/_program.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from executorch.exir.capture._config import EdgeCompileConfig, ExecutorchBackendConfig
1414
from executorch.exir.emit import emit_program, EmitterOutput
1515
from executorch.exir.error import ExportError
16-
from executorch.exir.pass_manager import PassManager, PassType
16+
from executorch.exir.pass_manager import PassType
1717
from executorch.exir.passes import (
1818
aten_to_edge_passes,
1919
EdgeToBackendOpsPass,
@@ -34,14 +34,6 @@
3434
Val = Any
3535

3636

37-
# Stub to ease migration from `transform` to private `_transform`
38-
def transform_exported_program(ep, *passes: PassType) -> ExportedProgram:
39-
if hasattr(ep, "_transform"):
40-
return ep._transform(*passes)
41-
else:
42-
return ep.transform(*passes)
43-
44-
4537
@compatibility(is_backward_compatible=False)
4638
class ExirExportedProgram:
4739
def __init__(
@@ -56,9 +48,7 @@ def __init__(
5648
self.after_to_edge_passes = after_to_edge_passes
5749

5850
def transform(self, *passes: PassType) -> "ExirExportedProgram":
59-
self.exported_program = transform_exported_program(
60-
self.exported_program, *passes
61-
)
51+
self.exported_program = self.exported_program._transform(*passes)
6252
return self
6353

6454
def __call__(self, *args: Any) -> Any:
@@ -86,7 +76,7 @@ def to_executorch(
8676
raise RuntimeError("Must run to_edge before to_executorch.")
8777
config = config or ExecutorchBackendConfig()
8878
ep = self.exported_program
89-
new_prog = transform_exported_program(ep, *edge_to_executorch_passes(config))
79+
new_prog = ep._transform(*edge_to_executorch_passes(config))
9080
new_prog = ExirExportedProgram(new_prog, self.after_to_edge_passes)
9181
executorch_prog = ExecutorchProgram(
9282
new_prog,

0 commit comments

Comments
 (0)