aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/ops/image.cc
diff options
context:
space:
mode:
authorJerry Ge <jerry.ge@arm.com>2023-05-01 18:36:43 +0000
committerJerry Ge <jerry.ge@arm.com>2023-05-10 02:40:49 +0000
commit0bd4ec89d52cc1fd36e92dff2fb496b3550ee7f5 (patch)
treed2662a0e62aec08a648edf61da62ee789a481080 /reference_model/src/ops/image.cc
parenta4d748b08accce06fab93e2d2b96e499b35ae89b (diff)
downloadreference_model-0bd4ec89d52cc1fd36e92dff2fb496b3550ee7f5.tar.gz
Refactor ref_model rank checking and add level check to argmax
Signed-off-by: Jerry Ge <jerry.ge@arm.com> Change-Id: Iad035b31d5e5e83040068e6311501490765bfff7
Diffstat (limited to 'reference_model/src/ops/image.cc')
-rw-r--r--reference_model/src/ops/image.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/reference_model/src/ops/image.cc b/reference_model/src/ops/image.cc
index ca12cfe..575a500 100644
--- a/reference_model/src/ops/image.cc
+++ b/reference_model/src/ops/image.cc
@@ -113,11 +113,6 @@ int OpResize<InDtype, OutDtype, resize_t>::eval()
int16_t border_y = border[0];
int16_t border_x = border[1];
- // Check Tosa Level
- auto tosa_level = g_func_config.tosa_level;
- LEVEL_CHECK(scale_y_n / scale_y_d <= tosa_level.MAX_SCALE, "scale_y_n / scale_y_d should be smaller than or equal to MAX_SCALE");
- LEVEL_CHECK(scale_x_n / scale_x_d <= tosa_level.MAX_SCALE, "scale_x_n / scale_x_d should be smaller than or equal to MAX_SCALE");
-
ERROR_IF(std::max<int>({ in_height, in_width, out_height, out_width }) >= 16384,
"OpResize: exceeds maximum dimension");
ERROR_IF(in_batch != out_batch, "OpResize: output tensor batch mismatch");
@@ -137,6 +132,11 @@ int OpResize<InDtype, OutDtype, resize_t>::eval()
ERROR_IF((border_x < -16 * scale_x_n || border_x >= scale_x_n),
"OpResize: invalid attribute border width dimension");
+ // Check Tosa Level
+ auto tosa_level = g_func_config.tosa_level;
+ LEVEL_CHECK(scale_y_n / scale_y_d <= tosa_level.MAX_SCALE, "scale_y_n / scale_y_d should be smaller than or equal to MAX_SCALE");
+ LEVEL_CHECK(scale_x_n / scale_x_d <= tosa_level.MAX_SCALE, "scale_x_n / scale_x_d should be smaller than or equal to MAX_SCALE");
+
int32_t res_height = 0;
int32_t res_width = 0;