Skip to content

Commit 34f806e

Browse files
Arm backend: Convert asserts to raise errors in op_mul
Asserts are converted to proper raises to ensure graph integrity. Improve error message. Change-Id: Ifff799651a67811e1dacdb0af5d332dcb7b4b11e Signed-off-by: Sebastian Larsson <[email protected]>
1 parent 4022ff1 commit 34f806e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

backends/arm/operators/op_mul.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ def define_node(
4141
inputs: List[TosaArg],
4242
output: TosaArg,
4343
) -> None:
44-
assert inputs[0].dtype == inputs[1].dtype == output.dtype == ts.DType.INT8
44+
if (
45+
inputs[0].dtype != ts.DType.INT8
46+
or inputs[1].dtype != ts.DType.INT8
47+
or output.dtype != ts.DType.INT8
48+
):
49+
raise ValueError(
50+
f"Inputs and output for {self.target} need to be INT8, got "
51+
f"{inputs[0].dtype=}, {inputs[1].dtype=} and {output.dtype=}"
52+
)
4553

4654
dim_order = (
4755
inputs[0].dim_order

0 commit comments

Comments
 (0)