aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/ops/data_layout.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/data_layout.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/data_layout.cc')
-rw-r--r--reference_model/src/ops/data_layout.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/reference_model/src/ops/data_layout.cc b/reference_model/src/ops/data_layout.cc
index ce5b5af..a189466 100644
--- a/reference_model/src/ops/data_layout.cc
+++ b/reference_model/src/ops/data_layout.cc
@@ -42,6 +42,10 @@ OpConcat<Rank, Dtype>::~OpConcat()
template <int Rank, DType Dtype>
int OpConcat<Rank, Dtype>::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;
@@ -140,6 +144,10 @@ OpPad<Rank, Dtype>::~OpPad()
template <int Rank, DType Dtype>
int OpPad<Rank, Dtype>::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;
@@ -227,6 +235,11 @@ OpReshape<InRank, OutRank, Dtype>::~OpReshape()
template <int InRank, int OutRank, DType Dtype>
int OpReshape<InRank, OutRank, Dtype>::checkTensorAttributes()
{
+ // Check Tosa Level
+ auto tosa_level = g_func_config.tosa_level;
+ LEVEL_CHECK(InRank <= tosa_level.MAX_RANK, "InRank should be smaller than or equal to MAX_RANK");
+ LEVEL_CHECK(OutRank <= tosa_level.MAX_RANK, "OutRank should be smaller than or equal to MAX_RANK");
+
if (validateRequiredOperands())
return 1;
@@ -322,6 +335,10 @@ OpReverse<Rank, Dtype>::~OpReverse()
template <int Rank, DType Dtype>
int OpReverse<Rank, Dtype>::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;
@@ -389,6 +406,10 @@ OpSlice<Rank, Dtype>::~OpSlice()
template <int Rank, DType Dtype>
int OpSlice<Rank, Dtype>::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;
@@ -458,6 +479,10 @@ OpTileBase<Rank, Dtype>::~OpTileBase()
template <int Rank, DType Dtype>
int OpTileBase<Rank, Dtype>::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;
@@ -655,6 +680,10 @@ OpTranspose<Rank, Dtype>::~OpTranspose()
template <int Rank, DType Dtype>
int OpTranspose<Rank, Dtype>::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;