aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CPP/Utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/CPP/Utils.cpp')
-rw-r--r--tests/validation/CPP/Utils.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/validation/CPP/Utils.cpp b/tests/validation/CPP/Utils.cpp
index af3ed9099f..d163e8436f 100644
--- a/tests/validation/CPP/Utils.cpp
+++ b/tests/validation/CPP/Utils.cpp
@@ -35,8 +35,8 @@ namespace validation
template <typename T>
T bilinear_policy(const SimpleTensor<T> &in, Coordinates id, float xn, float yn, BorderMode border_mode, T constant_border_value)
{
- int idx = std::floor(xn);
- int idy = std::floor(yn);
+ const int idx = std::floor(xn);
+ const int idy = std::floor(yn);
const float dx = xn - idx;
const float dy = yn - idy;
@@ -94,6 +94,19 @@ RawTensor transpose(const RawTensor &src, int chunk_width)
return dst;
}
+
+bool valid_bilinear_policy(float xn, float yn, int width, int height, BorderMode border_mode)
+{
+ if(border_mode != BorderMode::UNDEFINED)
+ {
+ return true;
+ }
+ if((0 <= yn + 1) && (yn + 1 < height) && (0 <= xn + 1) && (xn + 1 < width))
+ {
+ return true;
+ }
+ return false;
+}
} // namespace validation
} // namespace test
} // namespace arm_compute