summaryrefslogtreecommitdiff
path: root/tests/AssetsLibrary.h
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2018-02-22 15:45:35 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-02-23 11:49:54 +0000
commit06ea048f062a50404b1b3998a61a45449c2d1f0f (patch)
treeaa0dea3b0c49422538df9a5a02578b2c29e6fa67 /tests/AssetsLibrary.h
parent292227986edb37b01061afcad6df18ba9d6ccbeb (diff)
downloadarmcl-06ea048f062a50404b1b3998a61a45449c2d1f0f.tar.gz
armcl-06ea048f062a50404b1b3998a61a45449c2d1f0f.tar.bz2
armcl-06ea048f062a50404b1b3998a61a45449c2d1f0f.zip
arm_compute v18.02
Change-Id: I7207aa488e5470f235f39b6c188b4678dc38d1a6
Diffstat (limited to 'tests/AssetsLibrary.h')
-rw-r--r--tests/AssetsLibrary.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h
index 1fe8c6373..7e2a042e9 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,21 +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);
- 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);
}