Skip to content

Update arm_tosa_e2e tests with new to_edge APIs #1047

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
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
15 changes: 7 additions & 8 deletions examples/arm/arm_tosa_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ def get_input_quantization_params(captured_model):
input_scales = {}
input_zeropoints = {}
input_names = []
for node in captured_model.exported_program.graph.nodes:
for node in captured_model.exported_program().graph.nodes:
if node.op == "placeholder":
input_names.append(node.name)
continue

for node in captured_model.exported_program.graph.nodes:
for node in captured_model.exported_program().graph.nodes:
if (
node.target
== exir_ops.edge.quantized_decomposed.quantize_per_tensor.default
Expand All @@ -78,11 +78,11 @@ def get_output_quantization_param(captured_model):
output_scale = 0.0
output_zeropoint = 0
output_name = ""
for node in captured_model.exported_program.graph.nodes:
for node in captured_model.exported_program().graph.nodes:
if node.op == "output":
output_name = node.args[0][0]

for node in captured_model.exported_program.graph.nodes:
for node in captured_model.exported_program().graph.nodes:
if (
node.target
== exir_ops.edge.quantized_decomposed.dequantize_per_tensor.default
Expand Down Expand Up @@ -172,7 +172,7 @@ def tosa_run_test(op, profile=TosaProfile.MI): # noqa: C901

# Export model
model_capture = export(model, inputs)
model_edge = to_edge(model_capture, _EDGE_COMPILE_CONFIG)
model_edge = to_edge(model_capture, compile_config=_EDGE_COMPILE_CONFIG)
ArmPartitioner.compile_spec = compile_spec

if profile == TosaProfile.BI:
Expand All @@ -185,9 +185,8 @@ def tosa_run_test(op, profile=TosaProfile.MI): # noqa: C901
output_quantization_zp,
) = get_output_quantization_param(model_edge)

model_edge = model_edge.transform(DuplicateDequantNodePass()).to_backend(
ArmPartitioner
)
model_edge = model_edge.transform((DuplicateDequantNodePass(),))
model_edge = model_edge.to_backend(ArmPartitioner)
exec_prog = model_edge.to_executorch()

# Save ground truth results to file
Expand Down