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
21 changes: 10 additions & 11 deletions backends/arm/operators/op_neg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
NodeVisitor,
register_node_visitor,
)

from executorch.backends.arm.operators.operator_validation_utils import (
validate_num_inputs,
validate_same_dtype,
)
from executorch.backends.arm.tosa_mapping import TosaArg


Expand Down Expand Up @@ -60,14 +63,12 @@ def define_node(
ts.DType.FP32,
}

validate_num_inputs(self.target, inputs, 1)
validate_same_dtype(self.target, [*inputs, output])

if inputs[0].dtype not in supported_dtypes:
raise ValueError(f"Unsupported dtype for NEGATE: {inputs[0].dtype}")

if inputs[0].dtype != output.dtype:
raise ValueError(
"All inputs and output need same dtype."
f"Got {inputs[0].dtype=}, {output.dtype=}"
)
input_zp, output_zp = get_negate_zero_points(
node, inputs[0].dtype == ts.DType.INT8
)
Expand Down Expand Up @@ -109,14 +110,12 @@ def define_node(
ts.DType.FP32,
}

validate_num_inputs(self.target, inputs, 1)
validate_same_dtype(self.target, [*inputs, output])

if inputs[0].dtype not in supported_dtypes:
raise ValueError(f"Unsupported dtype for NEGATE: {inputs[0].dtype}")

if inputs[0].dtype != output.dtype:
raise ValueError(
"All inputs and output need same dtype."
f"Got {inputs[0].dtype=}, {output.dtype=}"
)
input_zp, output_zp = get_negate_zero_points(
node, inputs[0].dtype == ts.DType.INT8
)
Expand Down
Loading