diff options
author | Sang-Hoon Park <sang-hoon.park@arm.com> | 2020-05-26 11:11:32 +0100 |
---|---|---|
committer | Sang-Hoon Park <sang-hoon.park@arm.com> | 2020-06-08 13:58:40 +0000 |
commit | f025a77e99224798cf4a28d7e17aef86d2f5792f (patch) | |
tree | 443e77ca011b3c8aedf901d99669a76c2a06879a /src/core/CL/kernels | |
parent | 238580f09e3e2a1f7144fd7892ce400ce1dabd76 (diff) | |
download | ComputeLibrary-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/CL/kernels')
-rw-r--r-- | src/core/CL/kernels/CLScaleKernel.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/core/CL/kernels/CLScaleKernel.cpp b/src/core/CL/kernels/CLScaleKernel.cpp index f41664f4e0..e19da32ac3 100644 --- a/src/core/CL/kernels/CLScaleKernel.cpp +++ b/src/core/CL/kernels/CLScaleKernel.cpp @@ -60,7 +60,7 @@ inline std::pair<float, float> calculate_scale_factors(const ITensorInfo &input, return std::make_pair(wr, hr); } -Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, bool align_corners) +Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, SamplingPolicy sampling_policy, bool align_corners) { ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(input); ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::U8, DataType::S16, DataType::F16, DataType::F32); @@ -68,6 +68,7 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, I ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(input, output); ARM_COMPUTE_RETURN_ERROR_ON(output == input); + ARM_COMPUTE_RETURN_ERROR_ON(align_corners && !is_align_corners_allowed(sampling_policy)); if(align_corners) { @@ -160,11 +161,9 @@ BorderSize CLScaleKernel::border_size() const Status CLScaleKernel::validate(const ITensorInfo *input, const ITensorInfo *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy, bool align_corners) { - BorderSize border = BorderSize(1); - const bool is_align_corners = policy == InterpolationPolicy::BILINEAR - && sampling_policy == SamplingPolicy::TOP_LEFT - && align_corners; - ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, policy, is_align_corners)); + BorderSize border = BorderSize(1); + + ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, policy, sampling_policy, align_corners)); ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), policy, border_mode, sampling_policy, border).first); return Status{}; @@ -188,16 +187,13 @@ void CLScaleKernel::configure(const ICLTensor *input, ICLTensor *output, Interpo void CLScaleKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy, bool align_corners) { - _align_corners = policy == InterpolationPolicy::BILINEAR - && sampling_policy == SamplingPolicy::TOP_LEFT - && align_corners; - - ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), policy, _align_corners)); + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), policy, sampling_policy, align_corners)); _input = input; _output = output; _interpolationPolicy = policy; _data_layout = input->info()->data_layout(); + _align_corners = align_corners; float wr = 0.f; float hr = 0.f; |