aboutsummaryrefslogtreecommitdiff
path: root/tests/AssetsLibrary.h
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2018-04-30 17:29:41 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:51:17 +0000
commit563494c2f447e201e88e6d7133a41e12971777eb (patch)
tree716ae5e4978ce378ad14f53591087a7a42f6fe58 /tests/AssetsLibrary.h
parentb7f5d172ccdb1d884388dd6e0e54f74241afca67 (diff)
downloadComputeLibrary-563494c2f447e201e88e6d7133a41e12971777eb.tar.gz
COMPMID-1084 Rework the way validation is performed for NHWC data layout
Change-Id: I00b95f560548da76718298b642c8166f92421097 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/129520 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Michele DiGiorgio <michele.digiorgio@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/AssetsLibrary.h')
-rw-r--r--tests/AssetsLibrary.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h
index 4bbe4c56f6..1fba3d4b46 100644
--- a/tests/AssetsLibrary.h
+++ b/tests/AssetsLibrary.h
@@ -456,10 +456,25 @@ void AssetsLibrary::fill(T &&tensor, D &&distribution, std::random_device::resul
std::mt19937 gen(_seed + seed_offset);
+ const bool is_nhwc = tensor.data_layout() == DataLayout::NHWC;
+ TensorShape shape(tensor.shape());
+
+ if(is_nhwc)
+ {
+ // Ensure that the equivalent tensors will be filled for both data layouts
+ permute(shape, PermutationVector(1U, 2U, 0U));
+ }
+
// Iterate over all elements
for(int element_idx = 0; element_idx < tensor.num_elements(); ++element_idx)
{
- const Coordinates id = index2coord(tensor.shape(), element_idx);
+ Coordinates id = index2coord(shape, element_idx);
+
+ if(is_nhwc)
+ {
+ // Write in the correct id for permuted shapes
+ permute(id, PermutationVector(2U, 0U, 1U));
+ }
// Iterate over all channels
for(int channel = 0; channel < tensor.num_channels(); ++channel)