aboutsummaryrefslogtreecommitdiff
path: root/src/core/NEON/kernels/NEScaleKernel.cpp
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-05-26 11:11:32 +0100
committerSang-Hoon Park <sang-hoon.park@arm.com>2020-06-08 13:58:40 +0000
commitf025a77e99224798cf4a28d7e17aef86d2f5792f (patch)
tree443e77ca011b3c8aedf901d99669a76c2a06879a /src/core/NEON/kernels/NEScaleKernel.cpp
parent238580f09e3e2a1f7144fd7892ce400ce1dabd76 (diff)
downloadComputeLibrary-f025a77e99224798cf4a28d7e17aef86d2f5792f.tar.gz
COMPMID-3363, COMPMID-3364: Add align_corners support to nearest neighbor
- Both NEON and CL's Scale Kernel now supports aligned corners with nearest neighbor interpolation - Unsupported combination (center sampling policy with aligned corners) now fails on validation - Test suites for CL and NEON are pruned by removing unsupported combination Change-Id: Ieea4f145a131593b89b471dcec2b09619136b17c Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3297 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/NEON/kernels/NEScaleKernel.cpp')
-rw-r--r--src/core/NEON/kernels/NEScaleKernel.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/core/NEON/kernels/NEScaleKernel.cpp b/src/core/NEON/kernels/NEScaleKernel.cpp
index 763ad49cb7..857084ef7e 100644
--- a/src/core/NEON/kernels/NEScaleKernel.cpp
+++ b/src/core/NEON/kernels/NEScaleKernel.cpp
@@ -66,18 +66,20 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *dx, const
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(offsets, 1, DataType::S32);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(dx, 1, DataType::F32);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(dy, 1, DataType::F32);
+ }
- if(info.align_corners)
- {
- // For bilinear method with aligned corners, the resize ratio will
- // be calculated by (input_size - 1)/(output_size - 1). Belows are
- // checking possible overflows.
- const auto input_width = input->dimension(width_index);
- const auto input_height = input->dimension(height_index);
-
- ARM_COMPUTE_RETURN_ERROR_ON(input_width == 0 || input_height == 0);
- ARM_COMPUTE_RETURN_ERROR_ON((output_width - 1 == 0) || (output_height - 1 == 0));
- }
+ ARM_COMPUTE_RETURN_ERROR_ON(info.align_corners && !is_align_corners_allowed(info.sampling_policy));
+
+ if(info.align_corners && is_align_corners_allowed(info.sampling_policy))
+ {
+ // For bilinear method with aligned corners, the resize ratio will
+ // be calculated by (input_size - 1)/(output_size - 1). Belows are
+ // checking possible overflows.
+ const auto input_width = input->dimension(width_index);
+ const auto input_height = input->dimension(height_index);
+
+ ARM_COMPUTE_RETURN_ERROR_ON(input_width == 0 || input_height == 0);
+ ARM_COMPUTE_RETURN_ERROR_ON((output_width - 1 == 0) || (output_height - 1 == 0));
}
if(info.interpolation_policy == InterpolationPolicy::AREA)
@@ -376,9 +378,7 @@ void NEScaleKernel::configure(const ITensor *input, const ITensor *dx, const ITe
_border_mode = info.border_mode;
_constant_border_value = info.constant_border_value;
_use_padding = info.use_padding;
- _align_corners = info.interpolation_policy == InterpolationPolicy::BILINEAR
- && info.sampling_policy == SamplingPolicy::TOP_LEFT
- && info.align_corners;
+ _align_corners = info.align_corners;
if(info.sampling_policy == SamplingPolicy::CENTER)
{