diff options
author | Gian Marco Iodice <gianmarco.iodice@arm.com> | 2018-04-11 10:49:04 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:49:16 +0000 |
commit | 2abb216e1aaeefe65c8a7e6294b4735f0647c927 (patch) | |
tree | 0e8be3d71e65b41ccae51796c154a2242e55ee2f | |
parent | a1be5ba07b344794a649510b9bb20968df204f6e (diff) | |
download | ComputeLibrary-2abb216e1aaeefe65c8a7e6294b4735f0647c927.tar.gz |
COMPMID-1045 - Fix shape_to_valid_region_gaussian_pyramid_half()
The utility function shape_to_valid_region_gaussian_pyramid_half() did not
calculate correctly the valid regions for levels above 1
Change-Id: Id818efe3b95ce4e0ba1bc57f091d912357a8134a
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/127380
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Sanghoon Lee <sanghoon.lee@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
-rw-r--r-- | tests/Utils.h | 12 | ||||
-rw-r--r-- | tests/datasets/ShapeDatasets.h | 3 | ||||
-rw-r--r-- | tests/validation/NEON/GaussianPyramid.cpp | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/tests/Utils.h b/tests/Utils.h index f61b94628a..4feed4e491 100644 --- a/tests/Utils.h +++ b/tests/Utils.h @@ -264,8 +264,8 @@ inline ValidRegion shape_to_valid_region_gaussian_pyramid_half(const TensorShape // Compute tensor shape for level "i" of Gaussian Pyramid Half // dst_width = (src_width + 1) * 0.5f // dst_height = (src_height + 1) * 0.5f - shape.set(0, (shape[0] + 1) * 0.5f); - shape.set(1, (shape[1] + 1) * 0.5f); + shape.set(0, (a_shape[0] + 1) * 0.5f); + shape.set(1, (a_shape[1] + 1) * 0.5f); if(border_undefined) { @@ -279,8 +279,8 @@ inline ValidRegion shape_to_valid_region_gaussian_pyramid_half(const TensorShape // 1) If the width/height of the tensor shape is odd, we have to take the ceil value of (a_valid_region.anchor.x() + border_size) / 2.0f or (a_valid_region.anchor.y() + border_size / 2.0f // 2) If the width/height of the tensor shape is even, we have to take the floor value of (a_valid_region.anchor.x() + border_size) / 2.0f or (a_valid_region.anchor.y() + border_size) / 2.0f // In this manner we should be able to propagate correctly the valid region along all levels of the pyramid - invalid_border_left = (shape[0] % 2) ? std::ceil(invalid_border_left) : std::floor(invalid_border_left); - invalid_border_top = (shape[1] % 2) ? std::ceil(invalid_border_top) : std::floor(invalid_border_top); + invalid_border_left = (a_shape[0] % 2) ? std::ceil(invalid_border_left) : std::floor(invalid_border_left); + invalid_border_top = (a_shape[1] % 2) ? std::ceil(invalid_border_top) : std::floor(invalid_border_top); // Set the anchor point anchor.set(0, static_cast<int>(invalid_border_left)); @@ -288,8 +288,8 @@ inline ValidRegion shape_to_valid_region_gaussian_pyramid_half(const TensorShape // Compute shape // Calculate the right and bottom invalid borders at the previous level of the pyramid - const float prev_invalid_border_right = static_cast<float>(shape[0] - (a_valid_region.anchor.x() + a_valid_region.shape[0])); - const float prev_invalid_border_bottom = static_cast<float>(shape[1] - (a_valid_region.anchor.y() + a_valid_region.shape[1])); + const float prev_invalid_border_right = static_cast<float>(a_shape[0] - (a_valid_region.anchor.x() + a_valid_region.shape[0])); + const float prev_invalid_border_bottom = static_cast<float>(a_shape[1] - (a_valid_region.anchor.y() + a_valid_region.shape[1])); // Calculate the right and bottom invalid borders at the current level of the pyramid const float invalid_border_right = std::ceil((prev_invalid_border_right + static_cast<float>(border_size)) / 2.0f); diff --git a/tests/datasets/ShapeDatasets.h b/tests/datasets/ShapeDatasets.h index 928ff736bc..8255672430 100644 --- a/tests/datasets/ShapeDatasets.h +++ b/tests/datasets/ShapeDatasets.h @@ -232,7 +232,8 @@ public: TensorShape{ 42U, 37U }, TensorShape{ 57U, 60U }, TensorShape{ 128U, 64U }, - TensorShape{ 83U, 72U } + TensorShape{ 83U, 72U }, + TensorShape{ 40U, 40U } }) { } diff --git a/tests/validation/NEON/GaussianPyramid.cpp b/tests/validation/NEON/GaussianPyramid.cpp index 024fd2b11f..0dea57e75b 100644 --- a/tests/validation/NEON/GaussianPyramid.cpp +++ b/tests/validation/NEON/GaussianPyramid.cpp @@ -46,7 +46,7 @@ namespace { constexpr AbsoluteTolerance<float> tolerance_fp32(1.0f); /**< Tolerance value for comparing reference's output against implementation's output */ -const auto small_gaussian_pyramid_levels = combine(datasets::Medium2DShapes(), datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 3); +const auto small_gaussian_pyramid_levels = combine(datasets::Medium2DShapes(), datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 4); const auto large_gaussian_pyramid_levels = combine(datasets::Large2DShapes(), datasets::BorderModes()) * framework::dataset::make("numlevels", 2, 5); template <typename T, typename U> @@ -102,7 +102,7 @@ FIXTURE_DATA_TEST_CASE(RunSmallGaussianPyramidHalf, NEGaussianPyramidHalfFixture FIXTURE_DATA_TEST_CASE(RunLargeGaussianPyramidHalf, NEGaussianPyramidHalfFixture<uint8_t>, framework::DatasetMode::NIGHTLY, large_gaussian_pyramid_levels) { - validate_gaussian_pyramid(_target, _reference, _border_mode, tolerance_fp32, 0.01f /* FIXME COMPMID-850: Increase tolerance while waiting for bug fix*/); + validate_gaussian_pyramid(_target, _reference, _border_mode, tolerance_fp32); } TEST_SUITE_END() TEST_SUITE_END() |