From 35ceeb2199c569810a1524a0a21c2df2a3f5f29e Mon Sep 17 00:00:00 2001 From: Diego Lopez Recas Date: Mon, 4 Dec 2017 18:56:10 +0000 Subject: IVGCVSW-798 Add Softmax NEON support for QASYMM8 Change-Id: I4f2cca52caf210fdb7d6bb7e9436ac51cb5088b4 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/112398 Reviewed-by: Anthony Barbier Tested-by: Jenkins --- src/core/IAccessWindow.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'src/core/IAccessWindow.cpp') diff --git a/src/core/IAccessWindow.cpp b/src/core/IAccessWindow.cpp index 693d851a5d..7dfe5db5c5 100644 --- a/src/core/IAccessWindow.cpp +++ b/src/core/IAccessWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -122,9 +122,10 @@ bool AccessWindowRectangle::update_window_if_needed(Window &window) const if(min_y < front_pad_y_available) { // Not enough padding available, need to shrink the window - const int start = adjust_up(min_y, front_pad_y_available, window.y().step() * _scale_y) - _y; + int start = adjust_up(min_y, front_pad_y_available, window.y().step() * _scale_y) - _y; + start = std::min(start / _scale_y, window.y().end()); - window.set(1, Window::Dimension(start / _scale_y, window.y().end(), window.y().step())); + window.set(1, Window::Dimension(start, window.y().end(), window.y().step())); window_modified = true; } @@ -143,8 +144,10 @@ bool AccessWindowRectangle::update_window_if_needed(Window &window) const if(static_cast(shape[1]) + tail_pad_y_available < max_y) { // Not enough padding available, need to shrink the window - const int end = adjust_down(max_y, shape[1] + tail_pad_y_available, window.y().step() * _scale_y) + window.y().step() * _scale_y - _y - _height; - window.set(1, Window::Dimension(window.y().start(), end / _scale_y, window.y().step())); + int end = adjust_down(max_y, shape[1] + tail_pad_y_available, window.y().step() * _scale_y) + window.y().step() * _scale_y - _y - _height; + end = std::max(window.y().start(), end / _scale_y); + + window.set(1, Window::Dimension(window.y().start(), end, window.y().step())); window_modified = true; } } @@ -164,8 +167,10 @@ bool AccessWindowRectangle::update_window_if_needed(Window &window) const if(min_x < front_pad_x_available) { // Not enough padding available, need to shrink the window - const int start = adjust_up(min_x, front_pad_x_available, window.x().step() * _scale_x) - _x; - window.set(0, Window::Dimension(start / _scale_x, window.x().end(), window.x().step())); + int start = adjust_up(min_x, front_pad_x_available, window.x().step() * _scale_x) - _x; + start = std::min(start / _scale_x, window.x().end()); + + window.set(0, Window::Dimension(start, window.x().end(), window.x().step())); window_modified = true; } @@ -181,8 +186,10 @@ bool AccessWindowRectangle::update_window_if_needed(Window &window) const if(static_cast(shape[0]) + tail_pad_x_available < max_x) { // Not enough padding available, need to shrink the window - const int end = adjust_down(max_x, shape[0] + tail_pad_x_available, window.x().step() * _scale_x) + window.x().step() * _scale_x - _x - _width; - window.set(0, Window::Dimension(window.x().start(), end / _scale_x, window.x().step())); + int end = adjust_down(max_x, shape[0] + tail_pad_x_available, window.x().step() * _scale_x) + window.x().step() * _scale_x - _x - _width; + end = std::max(window.x().start(), end / _scale_x); + + window.set(0, Window::Dimension(window.x().start(), end, window.x().step())); window_modified = true; } } @@ -192,7 +199,7 @@ bool AccessWindowRectangle::update_window_if_needed(Window &window) const return window_modified; } -bool AccessWindowRectangle::update_padding_if_needed(const Window &window) const +bool AccessWindowRectangle::update_padding_if_needed(const Window &window) { // Only update the padding if the tensor allows it if(_info == nullptr || !_info->is_resizable()) -- cgit v1.2.1