aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/reference/DepthToSpaceLayer.cpp
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2020-04-08 14:10:15 +0100
committerMichalis Spyrou <michalis.spyrou@arm.com>2020-04-17 14:20:01 +0000
commitd1d7722cfc5ee130115d8d195068a98b16102a21 (patch)
treef68f3ecca02ab4edde90189266fa186ec1a69474 /tests/validation/reference/DepthToSpaceLayer.cpp
parent4c6bd514a8d424a29b776754f1b3426fa3a8c339 (diff)
downloadComputeLibrary-d1d7722cfc5ee130115d8d195068a98b16102a21.tar.gz
COMPMID-3314: Enable OpenMP in the reference tests
Change-Id: I05b5fedb998317144e0dd13a6377a97207b27f46 Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3024 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/reference/DepthToSpaceLayer.cpp')
-rw-r--r--tests/validation/reference/DepthToSpaceLayer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/validation/reference/DepthToSpaceLayer.cpp b/tests/validation/reference/DepthToSpaceLayer.cpp
index 4135ce5471..e2329ed60b 100644
--- a/tests/validation/reference/DepthToSpaceLayer.cpp
+++ b/tests/validation/reference/DepthToSpaceLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -40,13 +40,14 @@ SimpleTensor<T> depth_to_space(const SimpleTensor<T> &src, const TensorShape &ds
ARM_COMPUTE_ERROR_ON(block_shape <= 0);
SimpleTensor<T> result(dst_shape, src.data_type());
- int in_pos = 0;
const auto width_in = static_cast<int>(src.shape()[0]);
const auto height_in = static_cast<int>(src.shape()[1]);
const auto channel_in = static_cast<int>(src.shape()[2]);
const auto batch_in = static_cast<int>(src.shape()[3]);
const int r = channel_in / (block_shape * block_shape);
-
+#if defined(_OPENMP)
+ #pragma omp parallel for collapse(4)
+#endif /* _OPENMP */
for(int b = 0; b < batch_in; ++b)
{
for(int z = 0; z < channel_in; ++z)
@@ -58,8 +59,8 @@ SimpleTensor<T> depth_to_space(const SimpleTensor<T> &src, const TensorShape &ds
const int out_x = (block_shape * x + (z / r) % block_shape);
const int out_y = (block_shape * y + (z / r) / block_shape);
const int out_pos = out_x + dst_shape[0] * out_y + (z % r) * dst_shape[0] * dst_shape[1] + b * dst_shape[0] * dst_shape[1] * dst_shape[2];
+ const int in_pos = x + width_in * y + z * width_in * height_in + b * width_in * height_in * channel_in;
result[out_pos] = src[in_pos];
- ++in_pos;
}
}
}