aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-07-02 10:49:39 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2020-07-03 17:39:20 +0000
commit94d5051bc56a59d857f8a09560e2da5c0d7894b0 (patch)
tree577d9ce10f73608a71c033b495b54457e6c5b1ab /tests
parent2aad21a900a21f467b3ec6b37420f892f0d80221 (diff)
downloadComputeLibrary-94d5051bc56a59d857f8a09560e2da5c0d7894b0.tar.gz
COMPMID-3539: Change indexing for nearest neighbor with aligned corners
For nearest neighbor interpolation policy with aligned corners all of NEON, CL and reference use round() rather than float to find the nearest integer. Change-Id: If0360da870e983303bf0424ca1100084084c1efc Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3495 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/validation/GLES_COMPUTE/Scale.cpp2
-rw-r--r--tests/validation/reference/Scale.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/tests/validation/GLES_COMPUTE/Scale.cpp b/tests/validation/GLES_COMPUTE/Scale.cpp
index 7a88159481..62b30da7a2 100644
--- a/tests/validation/GLES_COMPUTE/Scale.cpp
+++ b/tests/validation/GLES_COMPUTE/Scale.cpp
@@ -52,7 +52,7 @@ const auto ScaleDataTypes = framework::dataset::make("DataType",
DataType::F16,
});
-/** Align corners, this functionality is supported only by NEON */
+/** Aligned corners, this functionality is supported only by NEON and OpenCL backends */
const auto AlignCorners = framework::dataset::make("AlignCorners",
{
false,
diff --git a/tests/validation/reference/Scale.cpp b/tests/validation/reference/Scale.cpp
index 44beabb2d4..72f96d446d 100644
--- a/tests/validation/reference/Scale.cpp
+++ b/tests/validation/reference/Scale.cpp
@@ -25,6 +25,7 @@
#include "Scale.h"
#include "Utils.h"
+#include "arm_compute/core/utils/misc/Rounding.h"
#include "arm_compute/core/utils/misc/Utility.h"
#include "src/core/utils/ScaleUtils.h"
@@ -81,8 +82,8 @@ SimpleTensor<T> scale_core(const SimpleTensor<T> &in, float scale_x, float scale
switch(sampling_policy)
{
case SamplingPolicy::TOP_LEFT:
- x_src = std::floor(idx * wr);
- y_src = std::floor(idy * hr);
+ x_src = align_corners ? arm_compute::utils::rounding::round_half_away_from_zero(idx * wr) : std::floor(idx * wr);
+ y_src = align_corners ? arm_compute::utils::rounding::round_half_away_from_zero(idy * hr) : std::floor(idy * hr);
break;
case SamplingPolicy::CENTER:
//Calculate the source coords without -0.5f is equivalent to round the x_scr/y_src coords