aboutsummaryrefslogtreecommitdiff
path: root/src/armnnDeserializer/Deserializer.cpp
diff options
context:
space:
mode:
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2019-10-03 11:15:39 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-03 12:35:20 +0000
commit781ced9d1472486f86314e320a00d62329dcd363 (patch)
tree727c7081c84c023b4004202eeee025f0451ae904 /src/armnnDeserializer/Deserializer.cpp
parentce5045a00485f8a8c35814c0781ccbcca5678e5c (diff)
downloadarmnn-781ced9d1472486f86314e320a00d62329dcd363.tar.gz
IVGCVSW-3934 Add serialization support for INSTANCE_NORMALIZATION
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> Change-Id: If9b4d30cbd625206ec1c7d37dd8b449983442147
Diffstat (limited to 'src/armnnDeserializer/Deserializer.cpp')
-rw-r--r--src/armnnDeserializer/Deserializer.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/armnnDeserializer/Deserializer.cpp b/src/armnnDeserializer/Deserializer.cpp
index c85282f418..960d300fa5 100644
--- a/src/armnnDeserializer/Deserializer.cpp
+++ b/src/armnnDeserializer/Deserializer.cpp
@@ -204,6 +204,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_InstanceNormalizationLayer] = &Deserializer::ParseInstanceNormalization;
m_ParserFunctions[Layer_L2NormalizationLayer] = &Deserializer::ParseL2Normalization;
m_ParserFunctions[Layer_LstmLayer] = &Deserializer::ParseLstm;
m_ParserFunctions[Layer_MaximumLayer] = &Deserializer::ParseMaximum;
@@ -281,6 +282,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_InstanceNormalizationLayer:
+ return graphPtr->layers()->Get(layerIndex)->layer_as_InstanceNormalizationLayer()->base();
case Layer::Layer_L2NormalizationLayer:
return graphPtr->layers()->Get(layerIndex)->layer_as_L2NormalizationLayer()->base();
case Layer::Layer_LstmLayer:
@@ -1293,6 +1296,35 @@ void Deserializer::ParseGreater(GraphPtr graph, unsigned int layerIndex)
RegisterOutputSlots(graph, layerIndex, layer);
}
+void Deserializer::ParseInstanceNormalization(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 fbLayer = graph->layers()->Get(layerIndex)->layer_as_InstanceNormalizationLayer();
+ auto fbDescriptor = fbLayer->descriptor();
+
+ armnn::InstanceNormalizationDescriptor descriptor;
+ descriptor.m_Gamma = fbDescriptor->gamma();
+ descriptor.m_Beta = fbDescriptor->beta();
+ descriptor.m_Eps = fbDescriptor->eps();
+ descriptor.m_DataLayout = ToDataLayout(fbDescriptor->dataLayout());
+
+ const std::string layerName = GetLayerName(graph, layerIndex);
+ const armnn::TensorInfo outputInfo = ToTensorInfo(outputs[0]);
+
+ IConnectableLayer* layer = m_Network->AddInstanceNormalizationLayer(descriptor, layerName.c_str());
+ layer->GetOutputSlot(0).SetTensorInfo(outputInfo);
+
+ RegisterInputSlots(graph, layerIndex, layer);
+ RegisterOutputSlots(graph, layerIndex, layer);
+}
+
void Deserializer::ParseL2Normalization(GraphPtr graph, unsigned int layerIndex)
{
CHECK_LAYERS(graph, 0, layerIndex);