From f025a77e99224798cf4a28d7e17aef86d2f5792f Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Tue, 26 May 2020 11:11:32 +0100 Subject: 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 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3297 Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- src/runtime/NEON/functions/NEScale.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/runtime/NEON/functions/NEScale.cpp') diff --git a/src/runtime/NEON/functions/NEScale.cpp b/src/runtime/NEON/functions/NEScale.cpp index acde0cfcc5..a5d3ac76a5 100644 --- a/src/runtime/NEON/functions/NEScale.cpp +++ b/src/runtime/NEON/functions/NEScale.cpp @@ -97,8 +97,7 @@ NEScale::NEScale() // NOLINT _dy(), _scale_kernel(), _border_handler(), - _use_padding(true), - _align_corners(false) + _use_padding(true) { } @@ -107,10 +106,8 @@ void NEScale::configure(ITensor *input, ITensor *output, const ScaleKernelInfo & ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); ARM_COMPUTE_ERROR_THROW_ON(NEScale::validate(input->info(), output->info(), info)); - _use_padding = info.use_padding; - _align_corners = info.interpolation_policy == InterpolationPolicy::BILINEAR - && info.sampling_policy == SamplingPolicy::TOP_LEFT - && info.align_corners; + _use_padding = info.use_padding; + const bool is_align_corners_used = info.align_corners && is_align_corners_allowed(info.sampling_policy); // Get data layout and width/height indices const DataLayout data_layout = input->info()->data_layout(); @@ -121,8 +118,8 @@ void NEScale::configure(ITensor *input, ITensor *output, const ScaleKernelInfo & const TensorShape shape(output->info()->dimension(idx_width), output->info()->dimension(idx_height)); // Compute the ratio between source width/height and destination width/height - const auto wr = arm_compute::calculate_resize_ratio(input->info()->dimension(idx_width), output->info()->dimension(idx_width), _align_corners); - const auto hr = arm_compute::calculate_resize_ratio(input->info()->dimension(idx_height), output->info()->dimension(idx_height), _align_corners); + const auto wr = arm_compute::calculate_resize_ratio(input->info()->dimension(idx_width), output->info()->dimension(idx_width), is_align_corners_used); + const auto hr = arm_compute::calculate_resize_ratio(input->info()->dimension(idx_height), output->info()->dimension(idx_height), is_align_corners_used); // Get the element size of the input image const size_t input_element_size = input->info()->element_size(); -- cgit v1.2.1