From 0d677db72eb7945e304fc49cedf744f0c34ed330 Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Sun, 27 Jun 2021 22:39:21 +0100 Subject: IVGCVSW-6114 Create multiple LoadedNetworks from one OptimizedNetwork * Added IOptimizedNetwork constructor that takes another IOptimizedNetwork and a ModelOptions. * Changed PreCompiledLayer to use shared_ptr rather than unique_ptr to store the PreCompiledObject (no interface changes). * Added unit tests to ensure that PreCompiledLayer::Clone() clones the pointer to the PreCompiledObject correctly. Signed-off-by: Mike Kelly Change-Id: I3ef56055e0d189ffce9e651882d34da16c70a240 --- .../backendsCommon/test/CommonTestUtils.hpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/backends/backendsCommon/test/CommonTestUtils.hpp') diff --git a/src/backends/backendsCommon/test/CommonTestUtils.hpp b/src/backends/backendsCommon/test/CommonTestUtils.hpp index 99412b9694..c7537f1eed 100644 --- a/src/backends/backendsCommon/test/CommonTestUtils.hpp +++ b/src/backends/backendsCommon/test/CommonTestUtils.hpp @@ -18,6 +18,8 @@ #include #include +#include +#include // Checks that two collections have the exact same contents (in any order) // The given collections do not have to contain duplicates @@ -94,3 +96,24 @@ armnn::TensorShape MakeTensorShape(unsigned int batches, unsigned int height, unsigned int width, armnn::DataLayout layout); + +template +static std::vector GenerateRandomData(size_t size) +{ + constexpr bool isIntegerType = std::is_integral::value; + using Distribution = + typename std::conditional, + std::uniform_real_distribution>::type; + + static constexpr DataType lowerLimit = std::numeric_limits::min(); + static constexpr DataType upperLimit = std::numeric_limits::max(); + + static Distribution distribution(lowerLimit, upperLimit); + static std::default_random_engine generator; + + std::vector randomData(size); + generate(randomData.begin(), randomData.end(), []() { return distribution(generator); }); + + return randomData; +} -- cgit v1.2.1