COMPMID-3378: CLScale failure
authorManuel Bottini <manuel.bottini@arm.com>
Wed, 15 Apr 2020 16:31:25 +0000 (17:31 +0100)
committerManuel Bottini <manuel.bottini@arm.com>
Fri, 17 Apr 2020 09:17:52 +0000 (09:17 +0000)
Avoid creating tests for unsupported cases

Change-Id: Ida0835af2f3d83c39544e930f8f5be3d4471fa38
Signed-off-by: Manuel Bottini <manuel.bottini@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3022
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Sang-Hoon Park <sang-hoon.park@arm.com>
tests/validation/fixtures/ScaleFixture.h

index 8d851ce574f6416f797d809914ca506d13fb6540..e3846eda671355de673c4c621f70dc7076c88d71 100644 (file)
@@ -70,6 +70,22 @@ public:
         scale_x = ((shape[idx_width] * scale_x) > max_width) ? (max_width / shape[idx_width]) : scale_x;
         scale_y = ((shape[idx_height] * scale_y) > max_height) ? (max_height / shape[idx_height]) : scale_y;
 
+        const bool align_corners_a = policy == InterpolationPolicy::BILINEAR
+                                     && sampling_policy == SamplingPolicy::TOP_LEFT
+                                     && align_corners;
+
+        if(align_corners_a)
+        {
+            /* When align_corners = true is used for bilinear, both width and height
+             * of output should be > 1 to avoid overflow during computation otherwise
+             * it fails while checking argument values.
+             */
+            constexpr float min_width  = 2.f;
+            constexpr float min_height = 2.f;
+            scale_x                    = ((shape[idx_width] * scale_x) < min_width) ? (min_width / shape[idx_width]) : scale_x;
+            scale_y                    = ((shape[idx_height] * scale_y) < min_height) ? (min_height / shape[idx_height]) : scale_y;
+        }
+
         std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
         T                                      constant_border_value = static_cast<T>(distribution_u8(generator));