aboutsummaryrefslogtreecommitdiff
path: root/src/armnnDeserializer/Deserializer.cpp
diff options
context:
space:
mode:
authorNarumol Prangnawarat <narumol.prangnawarat@arm.com>2019-03-07 17:31:34 +0000
committerNarumol Prangnawarat <narumol.prangnawarat@arm.com>2019-03-08 09:53:20 +0000
commit495701f016117b405d90a69de0814bf60751d78b (patch)
tree282f36b385e76ab8bc6add250250d10089e4c450 /src/armnnDeserializer/Deserializer.cpp
parentac25a1beda8da71a82c0cf2795e2a6eaaeaa26b1 (diff)
downloadarmnn-495701f016117b405d90a69de0814bf60751d78b.tar.gz
IVGCVSW-2693 Serialize/de-serialize L2Normalization
Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com> Change-Id: I6a53ac576260383f32fb0d878b42d1251ffde94a
Diffstat (limited to 'src/armnnDeserializer/Deserializer.cpp')
-rw-r--r--src/armnnDeserializer/Deserializer.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/armnnDeserializer/Deserializer.cpp b/src/armnnDeserializer/Deserializer.cpp
index d62751d640..719e47e7ab 100644
--- a/src/armnnDeserializer/Deserializer.cpp
+++ b/src/armnnDeserializer/Deserializer.cpp
@@ -198,6 +198,7 @@ m_ParserFunctions(Layer_MAX+1, &Deserializer::ParseUnsupportedLayer)
m_ParserFunctions[Layer_FloorLayer] = &Deserializer::ParseFloor;
m_ParserFunctions[Layer_GatherLayer] = &Deserializer::ParseGather;
m_ParserFunctions[Layer_GreaterLayer] = &Deserializer::ParseGreater;
+ m_ParserFunctions[Layer_L2NormalizationLayer] = &Deserializer::ParseL2Normalization;
m_ParserFunctions[Layer_MaximumLayer] = &Deserializer::ParseMaximum;
m_ParserFunctions[Layer_MeanLayer] = &Deserializer::ParseMean;
m_ParserFunctions[Layer_MinimumLayer] = &Deserializer::ParseMinimum;
@@ -250,6 +251,8 @@ Deserializer::LayerBaseRawPtr Deserializer::GetBaseLayer(const GraphPtr& graphPt
return graphPtr->layers()->Get(layerIndex)->layer_as_GreaterLayer()->base();
case Layer::Layer_InputLayer:
return graphPtr->layers()->Get(layerIndex)->layer_as_InputLayer()->base()->base();
+ case Layer::Layer_L2NormalizationLayer:
+ return graphPtr->layers()->Get(layerIndex)->layer_as_L2NormalizationLayer()->base();
case Layer::Layer_MeanLayer:
return graphPtr->layers()->Get(layerIndex)->layer_as_MeanLayer()->base();
case Layer::Layer_MinimumLayer:
@@ -1074,6 +1077,31 @@ void Deserializer::ParseGreater(GraphPtr graph, unsigned int layerIndex)
RegisterOutputSlots(graph, layerIndex, layer);
}
+void Deserializer::ParseL2Normalization(GraphPtr graph, unsigned int layerIndex)
+{
+ CHECK_LAYERS(graph, 0, layerIndex);
+
+ auto inputs = GetInputs(graph, layerIndex);
+ CHECK_VALID_SIZE(inputs.size(), 1);
+
+ auto outputs = GetOutputs(graph, layerIndex);
+ CHECK_VALID_SIZE(outputs.size(), 1);
+ auto outputInfo = ToTensorInfo(outputs[0]);
+
+ auto flatBufferLayer = graph->layers()->Get(layerIndex)->layer_as_L2NormalizationLayer();
+ auto flatBufferDescriptor = flatBufferLayer->descriptor();
+
+ auto layerName = GetLayerName(graph, layerIndex);
+ armnn::L2NormalizationDescriptor descriptor;
+ descriptor.m_DataLayout = ToDataLayout(flatBufferDescriptor->dataLayout());
+
+ IConnectableLayer* layer = m_Network->AddL2NormalizationLayer(descriptor, layerName.c_str());
+ layer->GetOutputSlot(0).SetTensorInfo(outputInfo);
+
+ RegisterInputSlots(graph, layerIndex, layer);
+ RegisterOutputSlots(graph, layerIndex, layer);
+}
+
void Deserializer::ParseMinimum(GraphPtr graph, unsigned int layerIndex)
{
CHECK_LAYERS(graph, 0, layerIndex);