aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/ops/type_conversion.cc
diff options
context:
space:
mode:
authorJerry Ge <jerry.ge@arm.com>2023-04-11 00:05:02 +0000
committerJerry Ge <jerry.ge@arm.com>2023-04-20 22:53:37 +0000
commita793f4645d2c04543572de4d0bc84bf0a3689604 (patch)
treecfa8ff162c9315f079682c0913110ad25eb22cad /reference_model/src/ops/type_conversion.cc
parent714aa6039a7e3585bf81ac90ce301767c08295af (diff)
downloadreference_model-a793f4645d2c04543572de4d0bc84bf0a3689604.tar.gz
Add level checking to TOSA Ref model
Signed-off-by: Jerry Ge <jerry.ge@arm.com> Change-Id: I5689d7c6b902a319a68fa4628b59e0bcc23aeca4
Diffstat (limited to 'reference_model/src/ops/type_conversion.cc')
-rw-r--r--reference_model/src/ops/type_conversion.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/reference_model/src/ops/type_conversion.cc b/reference_model/src/ops/type_conversion.cc
index a3140c3..9034add 100644
--- a/reference_model/src/ops/type_conversion.cc
+++ b/reference_model/src/ops/type_conversion.cc
@@ -45,6 +45,10 @@ OpRescale<Rank, InDtype, OutDtype>::~OpRescale()
template <int Rank, DType InDtype, DType OutDtype>
int OpRescale<Rank, InDtype, OutDtype>::checkTensorAttributes()
{
+ // Check Tosa Level
+ auto tosa_level = g_func_config.tosa_level;
+ LEVEL_CHECK(Rank <= tosa_level.MAX_RANK, "Rank should be smaller than or equal to MAX_RANK");
+
if (validateRequiredOperands())
return 1;
@@ -250,6 +254,10 @@ OpCast<Rank, InDtype, OutDtype>::~OpCast()
template <int Rank, DType InDtype, DType OutDtype>
int OpCast<Rank, InDtype, OutDtype>::checkTensorAttributes()
{
+ // Check Tosa Level
+ auto tosa_level = g_func_config.tosa_level;
+ LEVEL_CHECK(Rank <= tosa_level.MAX_RANK, "Rank should be smaller than or equal to MAX_RANK");
+
if (validateRequiredOperands())
return 1;