Skip to content

Commit c544d0a

Browse files
perfacebook-github-bot
authored andcommitted
Handle output from TOSA reference model being int8 (#6190)
Summary: Move TOSA reference model pin. This adds bugfix for .npy array to now be aligned to output int8 for BI models. Make sure the dequantization not overflows by adding a cast to int32. Change-Id: I2274955bc02a6f3a75687bb2f731b2058834c44f Pull Request resolved: #6190 Reviewed By: kirklandsign Differential Revision: D64426319 Pulled By: digantdesai fbshipit-source-id: e1169b9420258934ebb82e1148c97ab0f1d206f7
1 parent 6ae8b1d commit c544d0a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

backends/arm/test/runner_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ def run_tosa_ref_model(
439439

440440
if self.is_quantized:
441441
# Need to dequant back to FP32 for comparison with torch output
442+
# Convert to int32 prior to dequantize the output
443+
if tosa_ref_output.dtype == np.int8:
444+
tosa_ref_output = tosa_ref_output.astype(np.int32)
442445
quant_param = self.qp_output
443446
assert (
444447
quant_param is not None

examples/arm/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ethos_u_base_rev="24.08"
8888

8989
# tosa reference model
9090
tosa_reference_model_url="https://review.mlplatform.org/tosa/reference_model"
91-
tosa_reference_model_rev="444eb365d92774430006e56a8c20161be2f2674f"
91+
tosa_reference_model_rev="f9ea4ab7da19318fe36b1c34d68a3e40fd6e56c5"
9292

9393
########
9494
### Mandatory user args

0 commit comments

Comments
 (0)