2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
5 #include "NormalizationLayer.hpp"
7 #include "LayerCloneBase.hpp"
9 #include <armnn/TypesUtils.hpp>
10 #include <backends/WorkloadData.hpp>
11 #include <backends/WorkloadFactory.hpp>
16 NormalizationLayer::NormalizationLayer(const NormalizationDescriptor& param, const char* name)
17 : LayerWithParameters(1, 1, LayerType::Normalization, param, name)
21 std::unique_ptr<IWorkload> NormalizationLayer::CreateWorkload(const Graph& graph, const IWorkloadFactory& factory) const
23 NormalizationQueueDescriptor descriptor;
24 return factory.CreateNormalization(descriptor, PrepInfoAndDesc(descriptor, graph));
27 NormalizationLayer* NormalizationLayer::Clone(Graph& graph) const
29 return CloneBase<NormalizationLayer>(graph, m_Param, GetName());
32 void NormalizationLayer::ValidateTensorShapesFromInputs()
34 ConditionalThrow<LayerValidationException>(GetInputSlot(0).GetConnection() != nullptr,
35 "NormalizationLayer: Input slot must be connected.");
37 const TensorShape& outShape = GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape();
38 ConditionalThrowIfNotEqual<LayerValidationException>(
39 "NormalizationLayer: TensorShape set on OutputSlot[0] does not match the inferred shape.",
40 GetOutputSlot(0).GetTensorInfo().GetShape(),