From 4c0fd83ef72edbf21a8a61c72b4178dbe561adcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85strand?= Date: Wed, 9 Oct 2024 20:24:45 +0200 Subject: [PATCH] Handle output from TOSA reference model being int8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move TOSA reference model. This add .npy array now is aligned to output int8 for BI models. Make sure the dequantization not overflows by adding a cast to int32. Signed-off-by: Per Åstrand Change-Id: I2274955bc02a6f3a75687bb2f731b2058834c44f --- backends/arm/test/runner_utils.py | 3 +++ examples/arm/setup.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backends/arm/test/runner_utils.py b/backends/arm/test/runner_utils.py index 5ca571f26da..167b99a3281 100644 --- a/backends/arm/test/runner_utils.py +++ b/backends/arm/test/runner_utils.py @@ -439,6 +439,9 @@ def run_tosa_ref_model( if self.is_quantized: # Need to dequant back to FP32 for comparison with torch output + # Convert to int32 prior to dequantize the output + if tosa_ref_output.dtype == np.int8: + tosa_ref_output = tosa_ref_output.astype(np.int32) quant_param = self.qp_output assert ( quant_param is not None diff --git a/examples/arm/setup.sh b/examples/arm/setup.sh index ef4a10289b7..ae335208cda 100755 --- a/examples/arm/setup.sh +++ b/examples/arm/setup.sh @@ -88,7 +88,7 @@ ethos_u_base_rev="24.08" # tosa reference model tosa_reference_model_url="https://review.mlplatform.org/tosa/reference_model" -tosa_reference_model_rev="444eb365d92774430006e56a8c20161be2f2674f" +tosa_reference_model_rev="f9ea4ab7da19318fe36b1c34d68a3e40fd6e56c5" ######## ### Mandatory user args