diff options
author | Gian Marco Iodice <gianmarco.iodice@arm.com> | 2018-06-13 14:05:54 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:53:57 +0000 |
commit | f1c2bf0971dd1c996da149faf3dd669d566074c7 (patch) | |
tree | 802b3ce5198c3209d77fc6b603c209023fe45650 /tests/validation/Helpers.cpp | |
parent | 89a2b571cfc0ea87c26ba8b1ed1ab87d13244f0e (diff) | |
download | ComputeLibrary-f1c2bf0971dd1c996da149faf3dd669d566074c7.tar.gz |
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 <bsgcomp@arm.com>
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'tests/validation/Helpers.cpp')
-rw-r--r-- | tests/validation/Helpers.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
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<float> &in, SimpleTensor<float> &out) template <typename T> void get_tile(const SimpleTensor<T> &in, SimpleTensor<T> &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<T> &in, SimpleTensor<T> &tile, const Coordinate } } +template <typename T> +void zeros(SimpleTensor<T> &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<T *>(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<float> &in, SimpleTensor<float> &roi, const Coordinates &coord); +template void zeros(SimpleTensor<float> &in, const Coordinates &anchor, const TensorShape &shape); } // namespace validation } // namespace test } // namespace arm_compute |