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/data_type.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ethosu/vela/data_type.py') diff --git a/ethosu/vela/data_type.py b/ethosu/vela/data_type.py index 829cef38..5d0320b2 100644 --- a/ethosu/vela/data_type.py +++ b/ethosu/vela/data_type.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 # @@ -110,7 +110,7 @@ class DataType: BaseType.Complex: "c", } assert self.type in numpy_dtype_code, f"Failed to interpret {self} as a numpy dtype" - return np.dtype(numpy_dtype_code[self.type] + str(self.size_in_bytes())) + return np.dtype(numpy_dtype_code[self.type] + str(self.size_in_bytes())).type stem_name = { BaseType.UnsignedInt: ("uint%s", True), -- cgit v1.2.1