From 951b8a4c01de2810349b6f16cf9bbba7578484fa Mon Sep 17 00:00:00 2001 From: Vidhya Sudhan Loganathan Date: Mon, 4 Nov 2019 14:42:08 +0000 Subject: COMPMID-2309 : CLConvolutionLayer: support QUANT8_SYMM_PER_CHANNEL filters Change-Id: I16f6758b768ede404a064db057302ded706e1e8a Signed-off-by: Vidhya Sudhan Loganathan Signed-off-by: Michele Di Giorgio Reviewed-on: https://review.mlplatform.org/c/2215 Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Reviewed-by: Gian Marco Iodice Comments-Addressed: Arm Jenkins --- tests/AssetsLibrary.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/AssetsLibrary.h') diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h index f8635ea576..9a22b2fefb 100644 --- a/tests/AssetsLibrary.h +++ b/tests/AssetsLibrary.h @@ -213,6 +213,19 @@ public: template void fill_boxes(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const; + /** Fills the specified @p raw tensor with random values drawn from @p + * distribution. + * + * @param[in, out] vec To be filled vector. + * @param[in] distribution Distribution used to fill the tensor. + * @param[in] seed_offset The offset will be added to the global seed before initialising the random generator. + * + * @note The @p distribution has to provide operator(Generator &) which + * will be used to draw samples. + */ + template + void fill(std::vector &vec, D &&distribution, std::random_device::result_type seed_offset) const; + /** Fills the specified @p raw tensor with random values drawn from @p * distribution. * @@ -521,6 +534,22 @@ void AssetsLibrary::fill_boxes(T &&tensor, D &&distribution, std::random_device: fill_borders_with_garbage(tensor, distribution, seed_offset); } +template +void AssetsLibrary::fill(std::vector &vec, D &&distribution, std::random_device::result_type seed_offset) const +{ + ARM_COMPUTE_ERROR_ON_MSG(vec.empty(), "Vector must not be empty"); + + using ResultType = typename std::remove_reference::type::result_type; + + std::mt19937 gen(_seed + seed_offset); + for(size_t i = 0; i < vec.size(); ++i) + { + const ResultType value = distribution(gen); + + vec[i] = value; + } +} + template void AssetsLibrary::fill(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const { -- cgit v1.2.1