[MLBEDSW-2787] Remove op.attrs["rescale"] in softmax.py
Added RescaleAdd operation to avoid non-standard attribute
"rescale" for Add operation. Also changed ResizeBilinear
in the same way.
Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com>
Change-Id: I1d286f63890585c06b8a161df1ff77e3f844a4b9
diff --git a/ethosu/vela/operation_util.py b/ethosu/vela/operation_util.py
index a55b954..7015b79 100644
--- a/ethosu/vela/operation_util.py
+++ b/ethosu/vela/operation_util.py
@@ -16,6 +16,7 @@
# Description:
# Utility functions for creating Network Operations.
from typing import Optional
+from typing import Tuple
from .data_type import DataType
from .high_level_command_to_npu_op import ifm_ifm2_correct_order
@@ -98,6 +99,21 @@
return create_binary_elementwise(Op.Add, name, ifm, ifm2, quantization, activation, dtype, attrs)
+def create_rescale_add(
+ name: str,
+ ifm: Tensor,
+ ifm2: Tensor,
+ rescale: Tuple[int, int],
+ quantization: QuantizationParameters,
+ activation: Optional[ActivationFunction] = None,
+ dtype: Optional[DataType] = None,
+ attrs: Optional[dict] = None,
+) -> Operation:
+ op = create_binary_elementwise(Op.RescaleAdd, name, ifm, ifm2, quantization, activation, dtype, attrs)
+ op.rescale = rescale
+ return op
+
+
def create_clz(
name: str,
ifm: Tensor,