diff options
author | Ioan-Cristian Szabo <ioan-cristian.szabo@arm.com> | 2017-10-27 17:35:40 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:47:18 +0000 |
commit | 91d20d95df35961d3eb5de497007d98576118d19 (patch) | |
tree | 13042e212d65fbf5bd7425079bb72b6bd1e2e84d /tests/AssetsLibrary.h | |
parent | 19835e591cb0b66a0f5000ae1505bf299e50337d (diff) | |
download | ComputeLibrary-91d20d95df35961d3eb5de497007d98576118d19.tar.gz |
COMPMID-582: Add validation to channel_extract kernels.
Change-Id: I6413a05f6870a0d04f12d7348269b15297ae8493
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/114696
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/AssetsLibrary.h')
-rw-r--r-- | tests/AssetsLibrary.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h index 9c93ee0757..afdf714ff1 100644 --- a/tests/AssetsLibrary.h +++ b/tests/AssetsLibrary.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -416,22 +416,24 @@ void AssetsLibrary::fill_borders_with_garbage(T &&tensor, D &&distribution, std: template <typename T, typename D> void AssetsLibrary::fill(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const { - Window window; - for(unsigned int d = 0; d < tensor.shape().num_dimensions(); ++d) - { - window.set(d, Window::Dimension(0, tensor.shape()[d], 1)); - } + using ResultType = typename std::remove_reference<D>::type::result_type; std::mt19937 gen(_seed + seed_offset); - //FIXME: Replace with normal loop - execute_window_loop(window, [&](const Coordinates & id) + // Iterate over all elements + for(int element_idx = 0; element_idx < tensor.num_elements(); ++element_idx) { - using ResultType = typename std::remove_reference<D>::type::result_type; - const ResultType value = distribution(gen); - void *const out_ptr = tensor(id); - store_value_with_data_type(out_ptr, value, tensor.data_type()); - }); + const Coordinates id = index2coord(tensor.shape(), element_idx); + + // Iterate over all channels + for(int channel = 0; channel < tensor.num_channels(); ++channel) + { + const ResultType value = distribution(gen); + ResultType &target_value = reinterpret_cast<ResultType *const>(tensor(id))[channel]; + + store_value_with_data_type(&target_value, value, tensor.data_type()); + } + } fill_borders_with_garbage(tensor, distribution, seed_offset); } |