From c0fe04d4105884b61b5eeca4c0a932846a77b6e2 Mon Sep 17 00:00:00 2001 From: Jeremy Johnson Date: Thu, 17 Feb 2022 12:29:35 +0000 Subject: Fix rescale test gen for scale32 & dtype Signed-off-by: Jeremy Johnson Change-Id: I65a7fac6e65d2b979139adaf6c5a42139b5493c2 --- verif/generator/tosa_test_gen.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/verif/generator/tosa_test_gen.py b/verif/generator/tosa_test_gen.py index e60e643..5f613f0 100644 --- a/verif/generator/tosa_test_gen.py +++ b/verif/generator/tosa_test_gen.py @@ -5146,17 +5146,17 @@ class TosaTestGen: max_shift_value_arr[i] = (1 << (shift_arr[i] - 2)) - 1 # print('multiplier {} shift {} inzp {} outzp {}'.format(multiplier_arr, shift_arr, input_zp, output_zp)) - if error_name is None: - # Make sure random values are within speicification + if scale32 and error_name is None: + # Make sure random values are within apply_scale_32 speicification # REQUIRES(value >= (-1<<(shift-2)) && value < (1<<(shift-2)) assert val.placeholderFilename values = np.load( os.path.join(self.basePath, self.testPath, val.placeholderFilename) ) - val_adj = np.subtract(values, input_zp) - val_adj = np.maximum(val_adj, min_shift_value_arr, dtype=values.dtype) - val_adj = np.minimum(val_adj, max_shift_value_arr, dtype=values.dtype) - val_adj = np.add(val_adj, input_zp) + val_adj = np.subtract(values, input_zp, dtype=np.int64) + val_adj = np.maximum(val_adj, min_shift_value_arr, dtype=np.int64) + val_adj = np.minimum(val_adj, max_shift_value_arr, dtype=np.int64) + val_adj = np.add(val_adj, input_zp, dtype=values.dtype) if not np.all(np.array_equal(values, val_adj)): # Values changed so overwrite file with new values np.save( -- cgit v1.2.1