diff options
author | evacha01 <evan.chandler@arm.com> | 2024-03-08 16:39:24 +0000 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2024-04-16 16:02:16 +0000 |
commit | 4a2051146f498cb9ec35d7213720540c5c3e81e2 (patch) | |
tree | 543000b3ef22bd587c3c7702100742e4b94eb5fb /verif/tests/test_tosa_refmodel.py | |
parent | 5d0e9c7f3748e80d6f14a3eeaef858eeb912e1fd (diff) | |
download | reference_model-4a2051146f498cb9ec35d7213720540c5c3e81e2.tar.gz |
SPECIAL data gen mode for FP16 and FP32
Signed-off-by: evacha01 <evan.chandler@arm.com>
Change-Id: I5a9a1c63345bd83ca04bc6c2a99b0ef3612971ee
Diffstat (limited to 'verif/tests/test_tosa_refmodel.py')
-rw-r--r-- | verif/tests/test_tosa_refmodel.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/verif/tests/test_tosa_refmodel.py b/verif/tests/test_tosa_refmodel.py index 24ee9e2..bb52a86 100644 --- a/verif/tests/test_tosa_refmodel.py +++ b/verif/tests/test_tosa_refmodel.py @@ -1,5 +1,5 @@ """Tests for tosa_reference_model.""" -# Copyright (c) 2022-2023, ARM Limited. +# Copyright (c) 2022-2024, ARM Limited. # SPDX-License-Identifier: Apache-2.0 import json import re @@ -134,9 +134,10 @@ class BuildTosaTest: # Tests - op_name, ref_model_type, num_expected_tests +# FP Special datagen adds a second expected test to FP16 and FP32 tests for OPs it is added to TEST_PARAMS = [ ("add", "int32", 1), - ("add", "fp32", 1), + ("add", "fp32", 2), ("abs", "int32", 1), ("abs", "fp32", 1), ("abs", "fp16", 1), @@ -223,13 +224,20 @@ def test_refmodel_simple_op(tosaTest): assert const_file.is_file() consts.append(np.load(str(const_file))) + # Check if the data is from FP special datagen which can give invalid results + fp_special_data = test_dir.match("*_fs") + # Perform Numpy operation if op_name == "abs": assert len(tensors) == 1 result = np.abs(tensors[0]) elif op_name == "add": assert len(tensors) == 2 - result = np.add(tensors[0], tensors[1]) + if fp_special_data: + with np.errstate(invalid="ignore"): + result = np.add(tensors[0], tensors[1]) + else: + result = np.add(tensors[0], tensors[1]) elif op_name == "concat": assert len(consts) == 1 # Get axis from test directory name |