Skip to content

Arm backend: Convert assert to raise ValueError for comparison operators #9931

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 7, 2025
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
8 changes: 5 additions & 3 deletions backends/arm/operators/op_eq.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def define_node(
inputs: List[TosaArg],
output: TosaArg,
) -> None:
assert (
inputs[0].dtype == inputs[1].dtype
), "EQ must have the same dtypes as input"
if inputs[0].dtype != inputs[1].dtype:
raise TypeError(
"All inputs need to have the same data type for operator EQ but got "
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
)

input_nodes = inputs
# Handle quantization
Expand Down
8 changes: 5 additions & 3 deletions backends/arm/operators/op_ge.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def define_node(
inputs: List[TosaArg],
output: TosaArg,
) -> None:
assert (
inputs[0].dtype == inputs[1].dtype
), "GE must have the same dtypes as input"
if inputs[0].dtype != inputs[1].dtype:
raise TypeError(
"All inputs need to have the same data type for operator GE but got "
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
)

input_nodes = inputs
# Handle quantization
Expand Down
8 changes: 5 additions & 3 deletions backends/arm/operators/op_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def define_node(
inputs: List[TosaArg],
output: TosaArg,
) -> None:
assert (
inputs[0].dtype == inputs[1].dtype
), "GT must have the same dtypes as input"
if inputs[0].dtype != inputs[1].dtype:
raise TypeError(
"All inputs need to have the same data type for operator GT but got "
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
)

input_nodes = inputs
# Handle quantization
Expand Down
8 changes: 5 additions & 3 deletions backends/arm/operators/op_le.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def define_node(
inputs: List[TosaArg],
output: TosaArg,
) -> None:
assert (
inputs[0].dtype == inputs[1].dtype
), "LE must have the same dtypes as input"
if inputs[0].dtype != inputs[1].dtype:
raise TypeError(
"All inputs need to have the same data type for operator LE but got "
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
)

input_nodes = inputs
# Handle quantization
Expand Down
8 changes: 5 additions & 3 deletions backends/arm/operators/op_lt.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def define_node(
inputs: List[TosaArg],
output: TosaArg,
) -> None:
assert (
inputs[0].dtype == inputs[1].dtype
), "LT must have the same dtypes as input"
if inputs[0].dtype != inputs[1].dtype:
raise TypeError(
"All inputs need to have the same data type for operator LT but got "
f"{inputs[0].dtype=}, {inputs[1].dtype=}"
)

input_nodes = inputs
# Handle quantization
Expand Down
Loading