From 3b1578e44b4c6a8c8c9a8e0891d3866a89bd66af Mon Sep 17 00:00:00 2001 From: Tim Hall Date: Fri, 13 Jan 2023 17:57:25 +0000 Subject: 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 --- ethosu/vela/lut.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ethosu/vela/lut.py') 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 +# SPDX-FileCopyrightText: Copyright 2020-2021, 2023 Arm Limited and/or its affiliates # # 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 -- cgit v1.2.1