aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/SubgraphView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnn/SubgraphView.cpp')
-rw-r--r--src/armnn/SubgraphView.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/armnn/SubgraphView.cpp b/src/armnn/SubgraphView.cpp
index 4259c4f288..3ede18151b 100644
--- a/src/armnn/SubgraphView.cpp
+++ b/src/armnn/SubgraphView.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017, 2019-2023 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017, 2019-2024 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -27,14 +27,17 @@ void AssertIfNullsOrDuplicates(const C& container, const std::string& errorMessa
std::unordered_set<T> duplicateSet;
std::for_each(container.begin(), container.end(), [&duplicateSet, &errorMessage](const T& i)
{
- // Ignore unused for release builds
- IgnoreUnused(errorMessage);
-
// Check if the item is valid
- ARMNN_ASSERT_MSG(i, errorMessage.c_str());
+ if (!i)
+ {
+ throw armnn::GraphValidationException(errorMessage.c_str());
+ }
// Check if a duplicate has been found
- ARMNN_ASSERT_MSG(duplicateSet.find(i) == duplicateSet.end(), errorMessage.c_str());
+ if (duplicateSet.find(i) != duplicateSet.end())
+ {
+ throw armnn::GraphValidationException(errorMessage.c_str());
+ }
duplicateSet.insert(i);
});
@@ -493,7 +496,8 @@ SubgraphView SubgraphView::GetWorkingCopy() const
void SubgraphView::SubstituteSubgraph(SubgraphView& subgraph, IConnectableLayer* substituteLayer)
{
- ARMNN_ASSERT(substituteLayer != nullptr);
+ ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(substituteLayer, "substituteLayer should not be null");
+
SubgraphView substituteSubgraph(substituteLayer);
SubstituteSubgraph(subgraph, substituteSubgraph);