diff options
Diffstat (limited to 'src/armnn/layers/MergeLayer.cpp')
-rw-r--r-- | src/armnn/layers/MergeLayer.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/armnn/layers/MergeLayer.cpp b/src/armnn/layers/MergeLayer.cpp index a3b098ae00..e8f92177eb 100644 --- a/src/armnn/layers/MergeLayer.cpp +++ b/src/armnn/layers/MergeLayer.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2019-2023 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2019-2024 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #include "MergeLayer.hpp" @@ -40,14 +40,23 @@ void MergeLayer::ValidateTensorShapesFromInputs() GetInputSlot(1).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, "MergeLayer"); } std::vector<TensorShape> MergeLayer::InferOutputShapes(const std::vector<TensorShape>& inputShapes) const { - ARMNN_ASSERT(inputShapes.size() == 2); + if (inputShapes.size() != 2) + { + throw armnn::Exception("inputShapes' size is \"" + std::to_string(inputShapes.size()) + + "\" - should be \"2\"."); + } ConditionalThrowIfNotEqual<LayerValidationException>( "MergeLayer: TensorShapes set on inputs do not match", |