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>
diff --git a/tests/validation/Helpers.h b/tests/validation/Helpers.h
index cae1976..4ee2112 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 @@
* @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__ */