diff options
author | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2021-01-18 15:21:03 +0100 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2021-01-20 14:50:26 +0000 |
commit | e82be7c1a000277b44da7e85c527229a1d5eab2a (patch) | |
tree | d8c1784f938b32fe3233e80fbc5f6ea90ecb321b /ethosu/vela/operation_util.py | |
parent | db5124c2b5e10b34c61b3e016bb597ba1c1574df (diff) | |
download | ethos-u-vela-e82be7c1a000277b44da7e85c527229a1d5eab2a.tar.gz |
[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
Diffstat (limited to 'ethosu/vela/operation_util.py')
-rw-r--r-- | ethosu/vela/operation_util.py | 16 |
1 files changed, 16 insertions, 0 deletions
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, |