aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/Helpers.h
diff options
context:
space:
mode:
authorIsabella Gottardi <isabella.gottardi@arm.com>2017-06-23 15:02:11 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:08 +0100
commitb797fa235f714440ffa7a2ad4eef7ae14ee45da4 (patch)
treeefdefae2963d612c1bb1f84b8b74823c64804702 /tests/validation/Helpers.h
parentac4e873dad6aa6291fc36aff62047a896db04f6a (diff)
downloadComputeLibrary-b797fa235f714440ffa7a2ad4eef7ae14ee45da4.tar.gz
COMPMID-424 - Implemented reference implementation and tests (NEON and CL) for TableLookup
Change-Id: I53098ee750ab07fe64e9e2af8df91954d64017f5 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79411 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Steven Niu <steven.niu@arm.com>
Diffstat (limited to 'tests/validation/Helpers.h')
-rw-r--r--tests/validation/Helpers.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/validation/Helpers.h b/tests/validation/Helpers.h
index cae1976bd6..4ee2112bcc 100644
--- a/tests/validation/Helpers.h
+++ b/tests/validation/Helpers.h
@@ -24,6 +24,7 @@
#ifndef __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__
#define __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__
+#include "ILutAccessor.h"
#include "Types.h"
#include "ValidationUserConfiguration.h"
@@ -210,7 +211,25 @@ inline TensorShape calculate_depth_concatenate_shape(std::vector<TensorShape> in
* @return A vector that contains the requested number of random ROIs
*/
std::vector<ROI> generate_random_rois(const TensorShape &shape, const ROIPoolingLayerInfo &pool_info, unsigned int num_rois, std::random_device::result_type seed);
+
+/** Helper function to fill the Lut random by a ILutAccessor.
+ *
+ * @param[in,out] table Accessor at the Lut.
+ *
+ */
+template <typename T>
+void fill_lookuptable(T &&table)
+{
+ std::mt19937 generator(user_config.seed.get());
+ std::uniform_int_distribution<typename T::value_type> distribution(std::numeric_limits<typename T::value_type>::min(), std::numeric_limits<typename T::value_type>::max());
+
+ for(int i = std::numeric_limits<typename T::value_type>::min(); i <= std::numeric_limits<typename T::value_type>::max(); i++)
+ {
+ table[i] = distribution(generator);
+ }
+}
+
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif //__ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__
+#endif /* __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ */