aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/register_command_stream_util.py
diff options
context:
space:
mode:
authorWilliam Isaksson <william.isaksson@arm.com>2024-01-10 12:28:04 +0100
committerRickard Bolin <rickard.bolin@arm.com>2024-01-18 13:24:26 +0000
commit56e5f0c22ebc995dae13c6b72b08b28934a7871a (patch)
treec0e7a25770d6d3dc8f15782a0e4529aff081ef3c /ethosu/vela/register_command_stream_util.py
parent84fe2f60d5c6a25fa73d081cc90ee858ebca821d (diff)
downloadethos-u-vela-56e5f0c22ebc995dae13c6b72b08b28934a7871a.tar.gz
CONV ops int16 tests failed after TensorFlow update
Adds support for setting the accumulator type using the quantized_bias_type attribute Change-Id: Ibde1149143b510a1c650a5a037d3ab92d878d7cd Signed-off-by: William Isaksson <william.isaksson@arm.com>
Diffstat (limited to 'ethosu/vela/register_command_stream_util.py')
-rw-r--r--ethosu/vela/register_command_stream_util.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/ethosu/vela/register_command_stream_util.py b/ethosu/vela/register_command_stream_util.py
index 74c4f90e..8a6f94e4 100644
--- a/ethosu/vela/register_command_stream_util.py
+++ b/ethosu/vela/register_command_stream_util.py
@@ -1,4 +1,4 @@
-# SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2020-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -21,6 +21,7 @@ from typing import NamedTuple
from typing import Optional
from . import numeric_util
+from .api import NpuAccumulatorType
from .api import NpuActivationOp
from .api import NpuAddressRange
from .api import NpuBlockOperation
@@ -42,6 +43,7 @@ from .errors import ByteSizeError
from .operation import Kernel
from .operation import PointXYZ
from .tensor import TensorFormat
+from .tflite.TensorType import TensorType
from ethosu.vela.range_set import AccessDirection
from ethosu.vela.range_set import MemoryAccessSet
from ethosu.vela.range_set import MemoryRangeSet
@@ -74,6 +76,15 @@ def check_length(length, required_multiple):
check_size(length, required_multiple, "length")
+def to_npu_acc_type(accType: TensorType) -> NpuAccumulatorType:
+ if accType == TensorType.INT32:
+ return NpuAccumulatorType.Int32
+ elif accType == TensorType.INT64:
+ return NpuAccumulatorType.Int40
+ else:
+ return NpuAccumulatorType.Default
+
+
def to_npu_kernel(kernel: Kernel) -> NpuKernel:
"""Converts the given internally used kernel object to NpuKernel (of public API)"""
return NpuKernel(