diff options
Diffstat (limited to 'tests/InferenceModel.hpp')
-rw-r--r-- | tests/InferenceModel.hpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/tests/InferenceModel.hpp b/tests/InferenceModel.hpp index 268f60301c..93716e1a6f 100644 --- a/tests/InferenceModel.hpp +++ b/tests/InferenceModel.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -15,7 +15,6 @@ #include <armnn/utility/NumericCast.hpp> #include <armnnUtils/TContainer.hpp> -#include "NetworkExecutionUtils/NetworkExecutionUtils.hpp" #include <common/include/ProfilingGuid.hpp> @@ -47,6 +46,40 @@ #include <vector> #include <type_traits> +namespace +{ + +inline bool CheckRequestedBackendsAreValid(const std::vector<armnn::BackendId>& backendIds, + armnn::Optional<std::string&> invalidBackendIds = armnn::EmptyOptional()) +{ + if (backendIds.empty()) + { + return false; + } + + armnn::BackendIdSet validBackendIds = armnn::BackendRegistryInstance().GetBackendIds(); + + bool allValid = true; + for (const auto& backendId : backendIds) + { + if (std::find(validBackendIds.begin(), validBackendIds.end(), backendId) == validBackendIds.end()) + { + allValid = false; + if (invalidBackendIds) + { + if (!invalidBackendIds.value().empty()) + { + invalidBackendIds.value() += ", "; + } + invalidBackendIds.value() += backendId; + } + } + } + return allValid; +} + +} // anonymous namespace + namespace InferenceModelInternal { using BindingPointInfo = armnn::BindingPointInfo; |