diff options
author | Vidhya Sudhan Loganathan <vidhyasudhan.loganathan@arm.com> | 2019-11-04 14:42:08 +0000 |
---|---|---|
committer | Michele Di Giorgio <michele.digiorgio@arm.com> | 2019-11-14 16:25:06 +0000 |
commit | 951b8a4c01de2810349b6f16cf9bbba7578484fa (patch) | |
tree | 8b3ab1c04279da7be3afd6632a9894b6197c1e1b /tests/AssetsLibrary.h | |
parent | cd4e9abf7a165f15ccd10ac4541365d4f8a6db19 (diff) | |
download | ComputeLibrary-951b8a4c01de2810349b6f16cf9bbba7578484fa.tar.gz |
COMPMID-2309 : CLConvolutionLayer: support QUANT8_SYMM_PER_CHANNEL filters
Change-Id: I16f6758b768ede404a064db057302ded706e1e8a
Signed-off-by: Vidhya Sudhan Loganathan <vidhyasudhan.loganathan@arm.com>
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-on: https://review.mlplatform.org/c/2215
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/AssetsLibrary.h')
-rw-r--r-- | tests/AssetsLibrary.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h index f8635ea576..9a22b2fefb 100644 --- a/tests/AssetsLibrary.h +++ b/tests/AssetsLibrary.h @@ -216,6 +216,19 @@ public: /** 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 <typename T, typename D> + void fill(std::vector<T> &vec, 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] raw To be filled raw. * @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. @@ -522,6 +535,22 @@ void AssetsLibrary::fill_boxes(T &&tensor, D &&distribution, std::random_device: } template <typename T, typename D> +void AssetsLibrary::fill(std::vector<T> &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<D>::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 <typename T, typename D> void AssetsLibrary::fill(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const { using ResultType = typename std::remove_reference<D>::type::result_type; |