aboutsummaryrefslogtreecommitdiff
path: root/src/core/Helpers.cpp
diff options
context:
space:
mode:
authorMoritz Pflanzer <moritz.pflanzer@arm.com>2017-08-25 12:30:03 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commita184836f970c2245502fc5352e0652fa6fb7ed70 (patch)
tree602c586bd0c7435eec6939b6857e51c9b06cba1a /src/core/Helpers.cpp
parent5f9107280d098de719782530e19663cd655c9a71 (diff)
downloadComputeLibrary-a184836f970c2245502fc5352e0652fa6fb7ed70.tar.gz
COMPMID-417: Fix valid region
Change-Id: I35353670ea8beafe80958c849085b6ce48e4b373 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/85306 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/core/Helpers.cpp')
-rw-r--r--src/core/Helpers.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/Helpers.cpp b/src/core/Helpers.cpp
index ff903e9802..fc0b6e9361 100644
--- a/src/core/Helpers.cpp
+++ b/src/core/Helpers.cpp
@@ -50,7 +50,7 @@ Window arm_compute::calculate_max_window(const ITensorInfo &info, const Steps &s
anchor[0] + border_size.left,
// Skip the border right of the image
// Make sure the window width is a multiple of the step size
- anchor[0] + border_size.left + ceil_to_multiple(shape[0] - border_size.left - border_size.right, steps[0]),
+ anchor[0] + border_size.left + ceil_to_multiple(std::max(0, static_cast<int>(shape[0]) - static_cast<int>(border_size.left) - static_cast<int>(border_size.right)), steps[0]),
steps[0]));
size_t n = 1;
@@ -62,7 +62,7 @@ Window arm_compute::calculate_max_window(const ITensorInfo &info, const Steps &s
// Skip the border above the image
anchor[1] + border_size.top,
// Skip the border below the image
- anchor[1] + border_size.top + ceil_to_multiple(shape[1] - border_size.top - border_size.bottom, steps[1]),
+ anchor[1] + border_size.top + ceil_to_multiple(std::max(0, static_cast<int>(shape[1]) - static_cast<int>(border_size.top) - static_cast<int>(border_size.bottom)), steps[1]),
steps[1]));
++n;
@@ -137,7 +137,7 @@ Window arm_compute::calculate_max_window_horizontal(const ITensorInfo &info, con
anchor[0] + border_size.left,
// Skip the border right of the image
// Make sure the window width is a multiple of the step size
- anchor[0] + border_size.left + ceil_to_multiple(shape[0] - border_size.left - border_size.right, steps[0]),
+ anchor[0] + border_size.left + ceil_to_multiple(std::max(0, static_cast<int>(shape[0]) - static_cast<int>(border_size.left) - static_cast<int>(border_size.right)), steps[0]),
steps[0]));
size_t n = 1;