diff options
Diffstat (limited to 'src/armnn/layers/BatchNormalizationLayer.cpp')
-rw-r--r-- | src/armnn/layers/BatchNormalizationLayer.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/armnn/layers/BatchNormalizationLayer.cpp b/src/armnn/layers/BatchNormalizationLayer.cpp index 17463f8d4f..9936041093 100644 --- a/src/armnn/layers/BatchNormalizationLayer.cpp +++ b/src/armnn/layers/BatchNormalizationLayer.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 // #include "BatchNormalizationLayer.hpp" @@ -21,10 +21,25 @@ BatchNormalizationLayer::BatchNormalizationLayer(const armnn::BatchNormalization std::unique_ptr<IWorkload> BatchNormalizationLayer::CreateWorkload(const IWorkloadFactory& factory) const { // on this level constant data should not be released.. - ARMNN_ASSERT_MSG(m_Mean != nullptr, "BatchNormalizationLayer: Mean data should not be null."); - ARMNN_ASSERT_MSG(m_Variance != nullptr, "BatchNormalizationLayer: Variance data should not be null."); - ARMNN_ASSERT_MSG(m_Beta != nullptr, "BatchNormalizationLayer: Beta data should not be null."); - ARMNN_ASSERT_MSG(m_Gamma != nullptr, "BatchNormalizationLayer: Gamma data should not be null."); + if (!m_Mean) + { + throw armnn::NullPointerException("BatchNormalizationLayer: Mean data should not be null."); + } + + if (!m_Variance) + { + throw armnn::NullPointerException("BatchNormalizationLayer: Variance data should not be null."); + } + + if (!m_Beta) + { + throw armnn::NullPointerException("BatchNormalizationLayer: Beta data should not be null."); + } + + if (!m_Gamma) + { + throw armnn::NullPointerException("BatchNormalizationLayer: Gamma data should not be null."); + } BatchNormalizationQueueDescriptor descriptor; SetAdditionalInfo(descriptor); @@ -59,7 +74,12 @@ void BatchNormalizationLayer::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, "BatchNormalizationLayer"); |