aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/layers/PermuteLayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnn/layers/PermuteLayer.cpp')
-rw-r--r--src/armnn/layers/PermuteLayer.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/armnn/layers/PermuteLayer.cpp b/src/armnn/layers/PermuteLayer.cpp
index f8803a167e..3d3efc3209 100644
--- a/src/armnn/layers/PermuteLayer.cpp
+++ b/src/armnn/layers/PermuteLayer.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2017-2024 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -37,7 +37,12 @@ PermuteLayer* PermuteLayer::Clone(Graph& graph) const
std::vector<TensorShape> PermuteLayer::InferOutputShapes(const std::vector<TensorShape>& inputShapes) const
{
- ARMNN_ASSERT(inputShapes.size() == 1);
+ if (inputShapes.size() != 1)
+ {
+ throw armnn::Exception("inputShapes' size is \"" + std::to_string(inputShapes.size()) +
+ "\" - should be \"1\".");
+ }
+
const TensorShape& inShape = inputShapes[0];
return std::vector<TensorShape> ({armnnUtils::Permuted(inShape, m_Param.m_DimMappings)});
}
@@ -52,7 +57,12 @@ void PermuteLayer::ValidateTensorShapesFromInputs()
auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetTensorInfo().GetShape() });
- ARMNN_ASSERT(inferredShapes.size() == 1);
+ if (inferredShapes.size() != 1)
+ {
+ throw armnn::LayerValidationException("inferredShapes has "
+ + std::to_string(inferredShapes.size()) +
+ " elements - should only have 1.");
+ }
ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "PermuteLayer");
}