Skip to content

Arm backend: Convert assert to throw ValueError in tosa_backend #9905

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

Merged
merged 1 commit into from
Apr 4, 2025
Merged
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
10 changes: 6 additions & 4 deletions backends/arm/tosa_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ def preprocess( # noqa: C901
input_order = list(map(int, spec.value.decode().split(",")))

# Check that the output format is set correctly in the compile spec
assert output_format == "tosa", "output format must be tosa"
if output_format != "tosa":
raise ValueError(f'Invalid output format {output_format}, must be "tosa"')

tosa_spec = get_tosa_spec(compile_spec)
assert (
tosa_spec is not None
), "TOSA backend needs a TOSA version specified in the CompileSpec!"
if tosa_spec is None:
raise ValueError(
"TOSA backend needs a TOSA version specified in the CompileSpec"
)

logger.info(f"Converting ExportedProgram to TOSA: {tosa_spec}")

Expand Down
Loading