From f1c2bf0971dd1c996da149faf3dd669d566074c7 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Wed, 13 Jun 2018 14:05:54 +0100 Subject: COMPMID-1201 - Implementing Winograd Convolution Layer 1x3 and 3x1 kernels on OpenCL Change-Id: I39667bab49daa4da009694163274a59fd3574c73 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/137595 Tested-by: Jenkins Reviewed-by: Giorgio Arena Reviewed-by: Georgios Pinitas --- tests/validation/Helpers.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'tests/validation/Helpers.cpp') diff --git a/tests/validation/Helpers.cpp b/tests/validation/Helpers.cpp index e2415a203e..ff69b1c4b6 100644 --- a/tests/validation/Helpers.cpp +++ b/tests/validation/Helpers.cpp @@ -215,7 +215,7 @@ void transpose_matrix(const SimpleTensor &in, SimpleTensor &out) template void get_tile(const SimpleTensor &in, SimpleTensor &tile, const Coordinates &coord) { - ARM_COMPUTE_ERROR_ON(tile.shape().num_dimensions() != 2); + ARM_COMPUTE_ERROR_ON(tile.shape().num_dimensions() > 2); const int w_tile = tile.shape()[0]; const int h_tile = tile.shape()[1]; @@ -272,7 +272,36 @@ void get_tile(const SimpleTensor &in, SimpleTensor &tile, const Coordinate } } +template +void zeros(SimpleTensor &in, const Coordinates &anchor, const TensorShape &shape) +{ + ARM_COMPUTE_ERROR_ON(anchor.num_dimensions() != shape.num_dimensions()); + ARM_COMPUTE_ERROR_ON(in.shape().num_dimensions() > 2); + ARM_COMPUTE_ERROR_ON(shape.num_dimensions() > 2); + + // Check if with the dimensions greater than 2 we could have out-of-bound reads + for(size_t d = 0; d < Coordinates::num_max_dimensions; ++d) + { + if(anchor[d] < 0 || ((anchor[d] + shape[d]) > in.shape()[d])) + { + ARM_COMPUTE_ERROR("anchor[d] < 0 || (anchor[d] + shape[d]) > in.shape()[d]"); + } + } + + // Get input pointer + auto in_ptr = static_cast(in(anchor[0] + anchor[1] * in.shape()[0])); + + const unsigned int n = in.shape()[0]; + + for(unsigned int y = 0; y < shape[1]; ++y) + { + std::fill(in_ptr, in_ptr + shape[0], 0); + in_ptr += n; + } +} + template void get_tile(const SimpleTensor &in, SimpleTensor &roi, const Coordinates &coord); +template void zeros(SimpleTensor &in, const Coordinates &anchor, const TensorShape &shape); } // namespace validation } // namespace test } // namespace arm_compute -- cgit v1.2.1