Skip to content
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
13 changes: 10 additions & 3 deletions backends/arm/operators/op_clamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def cast_type(value: Any) -> int | float:
# Attempt to cast to float
return float(value)

assert 2 <= len(node.args) <= 3
if len(node.args) != 2 and len(node.args) != 3:
raise ValueError(f"Expected len(node.args) to be 2 or 3, got {node.args}")

min_arg = dtype_min
max_arg = dtype_max
Expand All @@ -84,7 +85,10 @@ def define_node(
inputs: List[TosaArg],
output: TosaArg,
) -> None:
assert len(node.all_input_nodes) == 1
if len(node.all_input_nodes) != 1:
raise ValueError(
f"Expected 1 input for {self.target}, got {len(node.all_input_nodes)}"
)

min_int8, max_int8 = self._get_min_max_arguments(
node,
Expand Down Expand Up @@ -122,7 +126,10 @@ def define_node(
inputs: List[TosaArg],
output: TosaArg,
) -> None:
assert len(node.all_input_nodes) == 1
if len(node.all_input_nodes) != 1:
raise ValueError(
f"Expected 1 input for {self.target}, got {len(node.all_input_nodes)}"
)

if inputs[0].dtype == ts.DType.INT8:
# Call the inherited define_node for handling integers
Expand Down
Loading