diff --git a/backends/arm/tosa_backend.py b/backends/arm/tosa_backend.py index 3f9c7755f83..314f4c7d291 100644 --- a/backends/arm/tosa_backend.py +++ b/backends/arm/tosa_backend.py @@ -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}")