From e82be7c1a000277b44da7e85c527229a1d5eab2a Mon Sep 17 00:00:00 2001 From: Fredrik Svedberg Date: Mon, 18 Jan 2021 15:21:03 +0100 Subject: [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 Change-Id: I1d286f63890585c06b8a161df1ff77e3f844a4b9 --- ethosu/vela/operation_util.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ethosu/vela/operation_util.py') diff --git a/ethosu/vela/operation_util.py b/ethosu/vela/operation_util.py index a55b9548..7015b799 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 @@ def create_add( 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, -- cgit v1.2.1