aboutsummaryrefslogtreecommitdiff
path: root/src/core/utils/ScaleUtils.cpp
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2020-07-30 14:52:16 +0100
committerMichele Di Giorgio <michele.digiorgio@arm.com>2020-07-31 14:04:56 +0000
commit7a81d2aaf33d1d134148d051b901567db5908922 (patch)
treed56e1d89fb1c94f7f2697ee61c8d886f38c56643 /src/core/utils/ScaleUtils.cpp
parentef6ec50eff04adb3e5d60ba96a1a7d9118b10c5a (diff)
downloadComputeLibrary-7a81d2aaf33d1d134148d051b901567db5908922.tar.gz
COMPMID-3624: CTS failure on Resize quantized in Neon and CL
Allow computations with aligned corners when the tensors have width/height equal to 1. Change-Id: Ia01733f6c02e0740835b26a794b9a79fa35319b4 Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3634 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Sadik Armagan <sadik.armagan@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/utils/ScaleUtils.cpp')
-rw-r--r--src/core/utils/ScaleUtils.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/core/utils/ScaleUtils.cpp b/src/core/utils/ScaleUtils.cpp
index bf059f7df2..d46ca0ea8e 100644
--- a/src/core/utils/ScaleUtils.cpp
+++ b/src/core/utils/ScaleUtils.cpp
@@ -26,7 +26,7 @@
float arm_compute::scale_utils::calculate_resize_ratio(size_t input_size, size_t output_size, bool align_corners)
{
- const size_t offset = align_corners ? 1 : 0;
+ const size_t offset = (align_corners && output_size > 1) ? 1 : 0;
const auto in = input_size - offset;
const auto out = output_size - offset;
@@ -34,11 +34,4 @@ float arm_compute::scale_utils::calculate_resize_ratio(size_t input_size, size_t
ARM_COMPUTE_ERROR_ON(out == 0);
return static_cast<float>(in) / static_cast<float>(out);
-}
-
-bool arm_compute::scale_utils::is_align_corners_allowed_output_shape(const TensorShape &output_shape, DataLayout layout)
-{
- const size_t idx_width = get_data_layout_dimension_index(layout, DataLayoutDimension::WIDTH);
- const size_t idx_height = get_data_layout_dimension_index(layout, DataLayoutDimension::HEIGHT);
- return (output_shape[idx_width] > 1) && (output_shape[idx_height] > 1);
} \ No newline at end of file