aboutsummaryrefslogtreecommitdiff
path: root/verif/generator/tosa_test_gen.py
diff options
context:
space:
mode:
authorJerry Ge <jerry.ge@arm.com>2024-02-20 11:21:19 -0800
committerEric Kunze <eric.kunze@arm.com>2024-03-05 18:47:09 +0000
commit51bd4f5166c50a89017307b55dee0f5bda096b7b (patch)
tree84aa5e9bd1dc02856ae10a18f0a923e3c8efbf55 /verif/generator/tosa_test_gen.py
parent1408795800719139e26bafcece88bfc07582576d (diff)
downloadreference_model-51bd4f5166c50a89017307b55dee0f5bda096b7b.tar.gz
Add Tosa Sin/Cos operators
- Add Tosa Sin/Cos operators to reference_model - Add conformances tests Signed-off-by: Jerry Ge <jerry.ge@arm.com> Change-Id: I3f597ddf5dac2c64d6dd6aa15781b40b8468eaa6
Diffstat (limited to 'verif/generator/tosa_test_gen.py')
-rw-r--r--verif/generator/tosa_test_gen.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/verif/generator/tosa_test_gen.py b/verif/generator/tosa_test_gen.py
index b472087..978e735 100644
--- a/verif/generator/tosa_test_gen.py
+++ b/verif/generator/tosa_test_gen.py
@@ -392,6 +392,12 @@ class TosaTestGen:
compliance_tens["abs_error_info"] = {
"lower_bound": op["compliance"]["abs_error_lower_bound"]
}
+ elif op["op"] in (Op.SIN, Op.COS):
+ mode = gtu.ComplianceMode.ABS_ERROR
+ if "compliance" in op and "abs_error_normal_divisor" in op["compliance"]:
+ compliance_tens["abs_error_info"] = {
+ "normal_divisor": op["compliance"]["abs_error_normal_divisor"]
+ }
else:
mode = gtu.ComplianceMode.EXACT
compliance_tens["mode"] = gtu.ComplianceMode(mode).name
@@ -4036,6 +4042,27 @@ class TosaTestGen:
TosaErrorValidator.evWrongOutputList,
),
},
+ "cos": {
+ "op": Op.COS,
+ "operands": (1, 0),
+ "build_fcn": (
+ build_unary,
+ TosaTensorGen.tgBasic,
+ TosaTensorValuesGen.tvgLazyGenDefault,
+ TosaArgGen.agNone,
+ ),
+ "types": TYPE_FP,
+ "error_if_validators": (
+ TosaErrorValidator.evWrongInputType,
+ TosaErrorValidator.evWrongOutputType,
+ TosaErrorValidator.evWrongInputList,
+ TosaErrorValidator.evWrongOutputList,
+ ),
+ "data_gen": {
+ "fp": (gtu.DataGenType.PSEUDO_RANDOM,),
+ },
+ "compliance": {"abs_error_normal_divisor": 2},
+ },
"exp": {
"op": Op.EXP,
"operands": (1, 0),
@@ -4180,6 +4207,27 @@ class TosaTestGen:
},
"compliance": {"ulp": 2},
},
+ "sin": {
+ "op": Op.SIN,
+ "operands": (1, 0),
+ "build_fcn": (
+ build_unary,
+ TosaTensorGen.tgBasic,
+ TosaTensorValuesGen.tvgLazyGenDefault,
+ TosaArgGen.agNone,
+ ),
+ "types": TYPE_FP,
+ "error_if_validators": (
+ TosaErrorValidator.evWrongInputType,
+ TosaErrorValidator.evWrongOutputType,
+ TosaErrorValidator.evWrongInputList,
+ TosaErrorValidator.evWrongOutputList,
+ ),
+ "data_gen": {
+ "fp": (gtu.DataGenType.PSEUDO_RANDOM,),
+ },
+ "compliance": {"abs_error_normal_divisor": 2},
+ },
# Elementwise Ternary operators
"select": {
"op": Op.SELECT,