aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2017-07-21 10:08:48 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commita2611815f278334c801094d095901d36e111c3f9 (patch)
tree1a2bf86b37614ce5473669b283dc37c708dd4957 /src/core
parenta629da13544c361ba9580a233109b2418fd6bb73 (diff)
downloadComputeLibrary-a2611815f278334c801094d095901d36e111c3f9.tar.gz
COMPMID-417 NEON/CL MeanStdDev bugfix using FillBorderKernel
Change-Id: Ic48ba7f69783d0e1e80611264e2bc67d1732436e Reviewed-on: http://mpd-gerrit.cambridge.arm.com/81293 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CL/kernels/CLMeanStdDevKernel.cpp10
-rw-r--r--src/core/NEON/kernels/NEMeanStdDevKernel.cpp10
-rw-r--r--src/core/NEON/kernels/NESoftmaxLayerKernel.cpp2
3 files changed, 19 insertions, 3 deletions
diff --git a/src/core/CL/kernels/CLMeanStdDevKernel.cpp b/src/core/CL/kernels/CLMeanStdDevKernel.cpp
index b0b748f466..1b70d7513f 100644
--- a/src/core/CL/kernels/CLMeanStdDevKernel.cpp
+++ b/src/core/CL/kernels/CLMeanStdDevKernel.cpp
@@ -40,10 +40,15 @@
using namespace arm_compute;
CLMeanStdDevKernel::CLMeanStdDevKernel()
- : _input(nullptr), _mean(nullptr), _stddev(nullptr), _global_sum(nullptr), _global_sum_squared(nullptr)
+ : _input(nullptr), _mean(nullptr), _stddev(nullptr), _global_sum(nullptr), _global_sum_squared(nullptr), _border_size(0)
{
}
+BorderSize CLMeanStdDevKernel::border_size() const
+{
+ return _border_size;
+}
+
void CLMeanStdDevKernel::configure(const ICLImage *input, float *mean, cl::Buffer *global_sum, float *stddev, cl::Buffer *global_sum_squared)
{
ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input);
@@ -83,6 +88,9 @@ void CLMeanStdDevKernel::configure(const ICLImage *input, float *mean, cl::Buffe
constexpr unsigned int num_elems_processed_per_iteration_x = 8;
const unsigned int num_elems_processed_per_iteration_y = input->info()->dimension(1);
+ _border_size = BorderSize(std::max(static_cast<int>(num_elems_processed_per_iteration_x) - static_cast<int>(input->info()->dimension(0)),
+ static_cast<int>(input->info()->dimension(0) % num_elems_processed_per_iteration_x)));
+
Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration_x, num_elems_processed_per_iteration_y));
AccessWindowRectangle input_access(input->info(), 0, 0, num_elems_processed_per_iteration_x, num_elems_processed_per_iteration_y);
update_window_and_padding(win, input_access);
diff --git a/src/core/NEON/kernels/NEMeanStdDevKernel.cpp b/src/core/NEON/kernels/NEMeanStdDevKernel.cpp
index 4616203d66..1eb7e45e36 100644
--- a/src/core/NEON/kernels/NEMeanStdDevKernel.cpp
+++ b/src/core/NEON/kernels/NEMeanStdDevKernel.cpp
@@ -85,10 +85,15 @@ std::pair<uint64x1_t, uint64x1_t> accumulate(const Window &window, Iterator &ite
} // namespace
NEMeanStdDevKernel::NEMeanStdDevKernel()
- : _input(nullptr), _mean(nullptr), _stddev(nullptr), _global_sum(nullptr), _global_sum_squared(nullptr), _mtx()
+ : _input(nullptr), _mean(nullptr), _stddev(nullptr), _global_sum(nullptr), _global_sum_squared(nullptr), _mtx(), _border_size(0)
{
}
+BorderSize NEMeanStdDevKernel::border_size() const
+{
+ return _border_size;
+}
+
void NEMeanStdDevKernel::configure(const IImage *input, float *mean, uint64_t *global_sum, float *stddev, uint64_t *global_sum_squared)
{
ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(input);
@@ -105,6 +110,9 @@ void NEMeanStdDevKernel::configure(const IImage *input, float *mean, uint64_t *g
constexpr unsigned int num_elems_processed_per_iteration = 16;
+ _border_size = BorderSize(std::max(static_cast<int>(num_elems_processed_per_iteration) - static_cast<int>(input->info()->dimension(0)),
+ static_cast<int>(input->info()->dimension(0) % num_elems_processed_per_iteration)));
+
// Configure kernel window
Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
diff --git a/src/core/NEON/kernels/NESoftmaxLayerKernel.cpp b/src/core/NEON/kernels/NESoftmaxLayerKernel.cpp
index 79fcba1dfb..176e3d688e 100644
--- a/src/core/NEON/kernels/NESoftmaxLayerKernel.cpp
+++ b/src/core/NEON/kernels/NESoftmaxLayerKernel.cpp
@@ -224,7 +224,7 @@ void NELogits1DMaxKernel::configure(const ITensor *input, ITensor *output)
_input = input;
_output = output;
- _border_size = BorderSize(0, input_width % num_elems_processed_per_iteration, 0, 0);
+ _border_size = BorderSize(0, num_elems_processed_per_iteration - (input_width % num_elems_processed_per_iteration), 0, 0);
// Configure kernel window
constexpr unsigned int num_elems_written_per_row = 1;