aboutsummaryrefslogtreecommitdiff
path: root/src/armnnDeserializer
diff options
context:
space:
mode:
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2019-09-20 10:42:02 +0100
committerÁron Virginás-Tar <aron.virginas-tar@arm.com>2019-09-20 15:12:12 +0000
commitda9d2d34ae57e18f631d4b42ad694a1d48270fe7 (patch)
tree0ff4050d85e55503c6a3b8dc75c9b25f324cf57a /src/armnnDeserializer
parent8a1b2184f7261eba82ad8346a3ec8bb7d5800f57 (diff)
downloadarmnn-da9d2d34ae57e18f631d4b42ad694a1d48270fe7.tar.gz
IVGCVSW-3886 Add serialization support for DepthToSpace
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> Change-Id: Id80c1bcbf50715f07a92dad08d554518a283cc28
Diffstat (limited to 'src/armnnDeserializer')
-rw-r--r--src/armnnDeserializer/Deserializer.cpp29
-rw-r--r--src/armnnDeserializer/Deserializer.hpp1
-rw-r--r--src/armnnDeserializer/DeserializerSupport.md1
3 files changed, 31 insertions, 0 deletions
diff --git a/src/armnnDeserializer/Deserializer.cpp b/src/armnnDeserializer/Deserializer.cpp
index 1c4d86cf34..d887357ef1 100644
--- a/src/armnnDeserializer/Deserializer.cpp
+++ b/src/armnnDeserializer/Deserializer.cpp
@@ -194,6 +194,7 @@ m_ParserFunctions(Layer_MAX+1, &Deserializer::ParseUnsupportedLayer)
m_ParserFunctions[Layer_ConcatLayer] = &Deserializer::ParseConcat;
m_ParserFunctions[Layer_ConstantLayer] = &Deserializer::ParseConstant;
m_ParserFunctions[Layer_Convolution2dLayer] = &Deserializer::ParseConvolution2d;
+ m_ParserFunctions[Layer_DepthToSpaceLayer] = &Deserializer::ParseDepthToSpace;
m_ParserFunctions[Layer_DepthwiseConvolution2dLayer] = &Deserializer::ParseDepthwiseConvolution2d;
m_ParserFunctions[Layer_DequantizeLayer] = &Deserializer::ParseDequantize;
m_ParserFunctions[Layer_DetectionPostProcessLayer] = &Deserializer::ParseDetectionPostProcess;
@@ -258,6 +259,8 @@ Deserializer::LayerBaseRawPtr Deserializer::GetBaseLayer(const GraphPtr& graphPt
return graphPtr->layers()->Get(layerIndex)->layer_as_ConstantLayer()->base();
case Layer::Layer_Convolution2dLayer:
return graphPtr->layers()->Get(layerIndex)->layer_as_Convolution2dLayer()->base();
+ case Layer::Layer_DepthToSpaceLayer:
+ return graphPtr->layers()->Get(layerIndex)->layer_as_DepthToSpaceLayer()->base();
case Layer::Layer_DepthwiseConvolution2dLayer:
return graphPtr->layers()->Get(layerIndex)->layer_as_DepthwiseConvolution2dLayer()->base();
case Layer::Layer_DequantizeLayer:
@@ -1115,6 +1118,32 @@ void Deserializer::ParseConvolution2d(GraphPtr graph, unsigned int layerIndex)
RegisterOutputSlots(graph, layerIndex, layer);
}
+void Deserializer::ParseDepthToSpace(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 fbDescriptor = graph->layers()->Get(layerIndex)->layer_as_DepthToSpaceLayer()->descriptor();
+
+ armnn::DepthToSpaceDescriptor descriptor;
+ descriptor.m_BlockSize = fbDescriptor->blockSize();
+ descriptor.m_DataLayout = ToDataLayout(fbDescriptor->dataLayout());
+
+ auto layerName = GetLayerName(graph, layerIndex);
+ IConnectableLayer* layer = m_Network->AddDepthToSpaceLayer(descriptor, layerName.c_str());
+
+ armnn::TensorInfo outputInfo = ToTensorInfo(outputs[0]);
+ layer->GetOutputSlot(0).SetTensorInfo(outputInfo);
+
+ RegisterInputSlots(graph, layerIndex, layer);
+ RegisterOutputSlots(graph, layerIndex, layer);
+}
+
void Deserializer::ParseDepthwiseConvolution2d(GraphPtr graph, unsigned int layerIndex)
{
CHECK_LAYERS(graph, 0, layerIndex);
diff --git a/src/armnnDeserializer/Deserializer.hpp b/src/armnnDeserializer/Deserializer.hpp
index 30af024f5e..0e2a34fc80 100644
--- a/src/armnnDeserializer/Deserializer.hpp
+++ b/src/armnnDeserializer/Deserializer.hpp
@@ -86,6 +86,7 @@ private:
void ParseConcat(GraphPtr graph, unsigned int layerIndex);
void ParseConstant(GraphPtr graph, unsigned int layerIndex);
void ParseConvolution2d(GraphPtr graph, unsigned int layerIndex);
+ void ParseDepthToSpace(GraphPtr graph, unsigned int layerIndex);
void ParseDepthwiseConvolution2d(GraphPtr graph, unsigned int layerIndex);
void ParseDequantize(GraphPtr graph, unsigned int layerIndex);
void ParseDetectionPostProcess(GraphPtr graph, unsigned int layerIndex);
diff --git a/src/armnnDeserializer/DeserializerSupport.md b/src/armnnDeserializer/DeserializerSupport.md
index 46bf92eadd..78ae51675f 100644
--- a/src/armnnDeserializer/DeserializerSupport.md
+++ b/src/armnnDeserializer/DeserializerSupport.md
@@ -15,6 +15,7 @@ The Arm NN SDK Deserialize parser currently supports the following layers:
* Concat
* Constant
* Convolution2d
+* DepthToSpace
* DepthwiseConvolution2d
* Dequantize
* DetectionPostProcess