Skip to content
Merged
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
12 changes: 6 additions & 6 deletions backends/cadence/aot/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def export_program(
return expo_program


def lower_ep_to_edge(
def _lower_ep_to_edge(
expo_program: ExportedProgram,
dump_graphs: bool = False,
constant_methods: Optional[dict[str, object]] = None,
Expand Down Expand Up @@ -250,7 +250,7 @@ def export_to_edge(
expo_program = export_program(model, inputs)

# Lower the model to edge IR.
edge_prog_manager = lower_ep_to_edge(expo_program, dump_graphs, constant_methods)
edge_prog_manager = _lower_ep_to_edge(expo_program, dump_graphs, constant_methods)

return edge_prog_manager

Expand All @@ -272,22 +272,22 @@ def quantize_and_export_to_edge(
dump_graphs=dump_graphs,
)

return lower_ep_to_edge(
return _lower_ep_to_edge(
quantized_model,
dump_graphs=dump_graphs,
constant_methods=constant_methods,
)


def lower_ep_to_cadence(
def _lower_ep_to_cadence(
program: ExportedProgram,
dump_graphs: bool = False,
opt_level: int = 1,
) -> EdgeProgramManager:
"""
Lower an existing ExportedProgram to edge IR and apply frontend optimization passes.
"""
edge_prog_manager = lower_ep_to_edge(program, dump_graphs=dump_graphs)
edge_prog_manager = _lower_ep_to_edge(program, dump_graphs=dump_graphs)
cadence_passes = get_cadence_passes(opt_level)

# Run a couple required passes for quant/dequant ops
Expand Down Expand Up @@ -329,7 +329,7 @@ def quantize_and_export_to_cadence(
"""
quantized_model = quantize_pt2(model, inputs)

return lower_ep_to_cadence(
return _lower_ep_to_cadence(
quantized_model,
opt_level=opt_level,
dump_graphs=dump_graphs,
Expand Down
2 changes: 1 addition & 1 deletion backends/cadence/aot/tests/test_remove_ops_passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def forward(self, x: torch.Tensor):
inputs = (x,)

graph_module = (
compiler.export_to_edge(
export_to_edge(
model,
inputs,
)
Expand Down
Loading