diff options
Diffstat (limited to 'tests/validation')
-rw-r--r-- | tests/validation/CL/Scale.cpp | 17 | ||||
-rw-r--r-- | tests/validation/NEON/Scale.cpp | 17 | ||||
-rw-r--r-- | tests/validation/fixtures/ScaleFixture.h | 7 | ||||
-rw-r--r-- | tests/validation/reference/Scale.cpp | 7 |
4 files changed, 7 insertions, 41 deletions
diff --git a/tests/validation/CL/Scale.cpp b/tests/validation/CL/Scale.cpp index 50c148dfba..8a010032a3 100644 --- a/tests/validation/CL/Scale.cpp +++ b/tests/validation/CL/Scale.cpp @@ -186,23 +186,6 @@ TEST_CASE(AlignedCornerNotSupported, framework::DatasetMode::ALL) ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS); } -TEST_CASE(InvalidAlignedCornerOutput, framework::DatasetMode::ALL) -{ - // Bilinear with aligned corners require at least 2x2 output to prevent overflow. - // Also, aligned corners require sampling policy to be TOP_LEFT. - constexpr auto interpolation_policy = InterpolationPolicy::BILINEAR; - constexpr bool align_corners = true; - constexpr auto sampling_policy = SamplingPolicy::TOP_LEFT; - const auto invalid_output_shape = TensorShape{ 1, 1, 3, 2 }; - - const auto input = TensorInfo{ default_input_shape, 1, default_data_type, default_data_layout }; - const auto output = TensorInfo{ invalid_output_shape, 1, default_data_type, default_data_layout }; - Status result{}; - - result = CLScale::validate(&input, &output, ScaleKernelInfo{ interpolation_policy, default_border_mode, PixelValue(), sampling_policy, default_use_padding, align_corners }); - ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS); -} - TEST_CASE(WindowShrink, framework::DatasetMode::ALL) { const auto input = TensorInfo{ TensorShape(37U, 37U, 2U), 1, DataType::F32 }; diff --git a/tests/validation/NEON/Scale.cpp b/tests/validation/NEON/Scale.cpp index f4a9b9df56..a7eb4b2d8d 100644 --- a/tests/validation/NEON/Scale.cpp +++ b/tests/validation/NEON/Scale.cpp @@ -244,23 +244,6 @@ TEST_CASE(AlignedCornerNotSupported, framework::DatasetMode::ALL) result = NEScale::validate(&input, &output, ScaleKernelInfo{ interpolation_policy, default_border_mode, PixelValue(), sampling_policy, default_use_padding, align_corners }); ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS); } - -TEST_CASE(InvalidAlignedCornerOutput, framework::DatasetMode::ALL) -{ - // Bilinear with aligned corners require at least 2x2 output to prevent overflow. - // Also, aligned corners require sampling policy to be TOP_LEFT. - constexpr auto interpolation_policy = InterpolationPolicy::BILINEAR; - constexpr bool align_corners = true; - constexpr auto sampling_policy = SamplingPolicy::TOP_LEFT; - const auto invalid_output_shape = TensorShape{ 1, 1, 3, 2 }; - - const auto input = TensorInfo{ input_shape, 1, default_data_type, default_data_layout }; - const auto output = TensorInfo{ invalid_output_shape, 1, default_data_type, default_data_layout }; - Status result{}; - - result = NEScale::validate(&input, &output, ScaleKernelInfo{ interpolation_policy, default_border_mode, PixelValue(), sampling_policy, default_use_padding, align_corners }); - ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS); -} TEST_SUITE_END() // Validate template <typename T> diff --git a/tests/validation/fixtures/ScaleFixture.h b/tests/validation/fixtures/ScaleFixture.h index 12d9012ece..b7a821fad4 100644 --- a/tests/validation/fixtures/ScaleFixture.h +++ b/tests/validation/fixtures/ScaleFixture.h @@ -74,11 +74,8 @@ protected: constexpr float max_width{ 8192.0f }; constexpr float max_height{ 6384.0f }; - - const bool is_align_corners_used = _align_corners && arm_compute::is_align_corners_allowed(_sampling_policy); - - const float min_width = is_align_corners_used ? 2.f : 1.f; - const float min_height = is_align_corners_used ? 2.f : 1.f; + const float min_width{ 1.f }; + const float min_height{ 1.f }; std::mt19937 generator(library->seed()); std::uniform_real_distribution<float> distribution_float(_min_scale, _max_scale); diff --git a/tests/validation/reference/Scale.cpp b/tests/validation/reference/Scale.cpp index cb4ad6f909..44beabb2d4 100644 --- a/tests/validation/reference/Scale.cpp +++ b/tests/validation/reference/Scale.cpp @@ -26,6 +26,7 @@ #include "Utils.h" #include "arm_compute/core/utils/misc/Utility.h" +#include "src/core/utils/ScaleUtils.h" namespace arm_compute { @@ -46,9 +47,11 @@ SimpleTensor<T> scale_core(const SimpleTensor<T> &in, float scale_x, float scale shape_scaled.set(1, (in.shape()[1] + round_value) * scale_y, /* apply_dim_correction = */ false); SimpleTensor<T> out(shape_scaled, in.data_type()); + align_corners = align_corners && arm_compute::scale_utils::is_align_corners_allowed_output_shape(out.shape(), DataLayout::NCHW); + // Compute the ratio between source width/height and destination width/height - const auto wr = arm_compute::calculate_resize_ratio(in.shape()[0], out.shape()[0], align_corners); - const auto hr = arm_compute::calculate_resize_ratio(in.shape()[1], out.shape()[1], align_corners); + const auto wr = arm_compute::scale_utils::calculate_resize_ratio(in.shape()[0], out.shape()[0], align_corners); + const auto hr = arm_compute::scale_utils::calculate_resize_ratio(in.shape()[1], out.shape()[1], align_corners); const auto width = static_cast<int>(in.shape().x()); const auto height = static_cast<int>(in.shape().y()); |