Add level checking to TOSA Ref model
Signed-off-by: Jerry Ge <jerry.ge@arm.com>
Change-Id: I5689d7c6b902a319a68fa4628b59e0bcc23aeca4
diff --git a/reference_model/src/ops/ewise_binary.cc b/reference_model/src/ops/ewise_binary.cc
index 16386af..6aa0c0f 100644
--- a/reference_model/src/ops/ewise_binary.cc
+++ b/reference_model/src/ops/ewise_binary.cc
@@ -44,6 +44,10 @@
template <int Rank, DType InDtype, DType OutDtype>
int BinaryNodeBase<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;
@@ -540,6 +544,10 @@
template <int Rank, DType InDtype>
int OpTable<Rank, InDtype>::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;