2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
5 #include "L2NormalizationLayer.hpp"
7 #include "LayerCloneBase.hpp"
9 #include <armnn/TypesUtils.hpp>
10 #include <backends/WorkloadData.hpp>
11 #include <backends/WorkloadFactory.hpp>
16 L2NormalizationLayer::L2NormalizationLayer(const char* name)
17 : Layer(1, 1, LayerType::L2Normalization, name)
21 std::unique_ptr<IWorkload> L2NormalizationLayer::CreateWorkload(const Graph& graph,
22 const IWorkloadFactory& factory) const
24 L2NormalizationQueueDescriptor descriptor;
25 return factory.CreateL2Normalization(descriptor, PrepInfoAndDesc(descriptor, graph));
28 L2NormalizationLayer* L2NormalizationLayer::Clone(Graph& graph) const
30 return CloneBase<L2NormalizationLayer>(graph, GetName());
33 void L2NormalizationLayer::ValidateTensorShapesFromInputs()
35 VerifyLayerConnections(1, CHECK_LOCATION());
37 auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() });
39 BOOST_ASSERT(inferredShapes.size() == 1);
41 ConditionalThrowIfNotEqual<LayerValidationException>(
42 "L2NormalizationLayer: TensorShape set on OutputSlot[0] does not match the inferred shape.",
43 GetOutputSlot(0).GetTensorInfo().GetShape(),