aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorevacha01 <evan.chandler@arm.com>2024-03-06 17:33:44 +0000
committerevacha01 <evan.chandler@arm.com>2024-03-07 12:52:13 +0000
commit1adff8301ac7e4933382549ad22b3b47cdb01eda (patch)
tree1cbe95bb38a9f877e5bbc89294064239e3e4b8b4
parent9c96eefbaca6c85be79529bce7ff04fd7dfe3a0d (diff)
downloadreference_model-1adff8301ac7e4933382549ad22b3b47cdb01eda.tar.gz
Add INT48 and INT4 datatype support to IDENTITY
Added support to ref model and testing Signed-off-by: evacha01 <evan.chandler@arm.com> Change-Id: Iece53d07c8986332fdd8f1ce5ed6265349df1b6a
-rw-r--r--reference_model/src/ops/data_nodes.cc2
-rw-r--r--reference_model/src/ops/op_factory.cc2
-rw-r--r--verif/conformance/tosa_base_profile_ops_info.json8
-rw-r--r--verif/generator/tosa_test_gen.py4
4 files changed, 15 insertions, 1 deletions
diff --git a/reference_model/src/ops/data_nodes.cc b/reference_model/src/ops/data_nodes.cc
index 64001a9..8b480ee 100644
--- a/reference_model/src/ops/data_nodes.cc
+++ b/reference_model/src/ops/data_nodes.cc
@@ -100,9 +100,11 @@ int OpIdentity<Rank, Dtype>::eval()
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, FP16);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, BF16);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, FP32);
+DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT4);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT8);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT16);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT32);
+DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT48);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, BOOL);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, FP64);
DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, FP8E4M3);
diff --git a/reference_model/src/ops/op_factory.cc b/reference_model/src/ops/op_factory.cc
index 1891ff4..5dc375d 100644
--- a/reference_model/src/ops/op_factory.cc
+++ b/reference_model/src/ops/op_factory.cc
@@ -569,8 +569,10 @@ GraphNode* OpFactory::newOp(SubgraphTraverser* sgt,
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, BF16);
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, FP32);
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT32);
+ DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT4);
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT8);
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT16);
+ DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, INT48);
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, BOOL);
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, FP64);
DEF_FACTORY_RANK0_6_ONE_RANK_ONE_TYPE(OpIdentity, FP8E4M3);
diff --git a/verif/conformance/tosa_base_profile_ops_info.json b/verif/conformance/tosa_base_profile_ops_info.json
index c8f3442..25a6076 100644
--- a/verif/conformance/tosa_base_profile_ops_info.json
+++ b/verif/conformance/tosa_base_profile_ops_info.json
@@ -1795,12 +1795,16 @@
"generator_args": [
[
"--target-dtype",
+ "int4",
+ "--target-dtype",
"int8",
"--target-dtype",
"int16",
"--target-dtype",
"int32",
"--target-dtype",
+ "int48",
+ "--target-dtype",
"bool",
"--tensor-dim-range",
"1,61",
@@ -1813,12 +1817,16 @@
],
[
"--target-dtype",
+ "int4",
+ "--target-dtype",
"int8",
"--target-dtype",
"int16",
"--target-dtype",
"int32",
"--target-dtype",
+ "int48",
+ "--target-dtype",
"bool",
"--tensor-dim-range",
"1,15",
diff --git a/verif/generator/tosa_test_gen.py b/verif/generator/tosa_test_gen.py
index a1f54c6..4309024 100644
--- a/verif/generator/tosa_test_gen.py
+++ b/verif/generator/tosa_test_gen.py
@@ -191,6 +191,8 @@ class TosaTestGen:
if dtype == DType.BOOL:
return np.bool_(self.rng.choice(a=[False, True], size=shape))
+ elif dtype == DType.INT4:
+ return np.int8(self.rng.integers(low=low, high=high, size=shape))
elif dtype == DType.INT8:
return np.int8(self.rng.integers(low=low, high=high, size=shape))
elif dtype == DType.UINT8:
@@ -4652,7 +4654,7 @@ class TosaTestGen:
TosaTensorValuesGen.tvgLazyGenDefault,
TosaArgGen.agNone,
),
- "types": TYPE_FIB,
+ "types": TYPE_FIB + [DType.INT4, DType.INT48],
"data_gen": {
"fp": (gtu.DataGenType.PSEUDO_RANDOM,),
},