diff options
author | Tim Hall <tim.hall@arm.com> | 2023-01-13 17:57:25 +0000 |
---|---|---|
committer | tim.hall <tim.hall@arm.com> | 2023-01-20 14:07:21 +0000 |
commit | 3b1578e44b4c6a8c8c9a8e0891d3866a89bd66af (patch) | |
tree | 491c337bc854d435b80f0a535496084ea9ebc9ac /ethosu/vela/lut.py | |
parent | f34904717f643499f3ea6210322bbe1b635db088 (diff) | |
download | ethos-u-vela-3b1578e44b4c6a8c8c9a8e0891d3866a89bd66af.tar.gz |
MLBEDSW-7151: MLCE: Difference in model output between x86 & aarch64
- The issue is due to undefined behaviour when casting a NumPy float
to a NumPy unsigned integer which occurs in create_const_tensor()
- The fix is to make sure that the values are first cast to a Python
float
- In addition, the values datatype argument has been removed from
create_const_tensor() to stop the tensor and values datatypes getting
out of sync
Change-Id: I134b9be8c941b361929a5ae7db8cb35f2e9728f2
Signed-off-by: Tim Hall <tim.hall@arm.com>
Diffstat (limited to 'ethosu/vela/lut.py')
-rw-r--r-- | ethosu/vela/lut.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ethosu/vela/lut.py b/ethosu/vela/lut.py index fdf9d0ff..d0ac9706 100644 --- a/ethosu/vela/lut.py +++ b/ethosu/vela/lut.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2020-2021 Arm Limited and/or its affiliates <open-source-office@arm.com> +# SPDX-FileCopyrightText: Copyright 2020-2021, 2023 Arm Limited and/or its affiliates <open-source-office@arm.com> # # SPDX-License-Identifier: Apache-2.0 # @@ -88,8 +88,7 @@ def create_lut_tensor(name, values, dtype): # address in constant memory, and unnecessary DMA operations can be avoided. sz = len(values) assert sz in (256, 512) - ntype = np.uint8 if dtype.size_in_bytes() == 1 else np.uint32 - tens = create_const_tensor(name, [1, 1, 1, sz], dtype, values, ntype, TensorPurpose.LUT) + tens = create_const_tensor(name, [1, 1, 1, sz], dtype, values, TensorPurpose.LUT) tens.equivalence_id = create_equivalence_id(tuple(values)) return tens |