diff options
author | Pablo Tello <pablo.tello@arm.com> | 2017-07-05 15:20:38 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:16:42 +0100 |
commit | 8fda1cb6f4142133fff045a6f9c18778757c316c (patch) | |
tree | 3f0ad562b24cc3c76e8a745cb59cd584b664ec57 /tests/validation/Helpers.h | |
parent | 8df3fafde3dcf131def3471db8e8b1a1c34b354b (diff) | |
download | ComputeLibrary-8fda1cb6f4142133fff045a6f9c18778757c316c.tar.gz |
COMPMID-421: Added FP16 support in BatchNormalizationLayer.
Change-Id: I7142e0e8466ef79e016ae56d285e8e9291573e52
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79814
Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation/Helpers.h')
-rw-r--r-- | tests/validation/Helpers.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/validation/Helpers.h b/tests/validation/Helpers.h index 2793c22147..8d70de6958 100644 --- a/tests/validation/Helpers.h +++ b/tests/validation/Helpers.h @@ -25,11 +25,13 @@ #define __ARM_COMPUTE_TEST_VALIDATION_HELPERS_H__ #include "arm_compute/core/Types.h" +#include "tests/Globals.h" #include "tests/ILutAccessor.h" #include "tests/Types.h" #include "tests/validation/ValidationUserConfiguration.h" #include "tests/validation/half.h" +#include <array> #include <random> #include <type_traits> #include <utility> @@ -41,6 +43,27 @@ namespace test { namespace validation { +/** Helper function to fill one or more tensors with the uniform distribution with int values. + * + * @param[in] dist Distribution to be used to get the values for the tensor. + * @param[in] seeds List of seeds to be used to fill each tensor. + * @param[in,out] tensor Tensor to be initialized with the values of the distribution. + * @param[in,out] other_tensors (Optional) One or more tensors to be filled. + * + */ +template <typename D, typename T, typename... Ts> +void fill_tensors(D &&dist, std::initializer_list<int> seeds, T &&tensor, Ts &&... other_tensors) +{ + const std::array < T, 1 + sizeof...(Ts) > tensors{ { std::forward<T>(tensor), std::forward<Ts>(other_tensors)... } }; + std::vector<int> vs(seeds); + ARM_COMPUTE_ERROR_ON(vs.size() != tensors.size()); + int k = 0; + for(auto tp : tensors) + { + library->fill(*tp, std::forward<D>(dist), vs[k++]); + } +} + /** Helper function to get the testing range for each activation layer. * * @param[in] activation Activation function to test. |