diff options
Diffstat (limited to 'src/armnnDeserializer')
-rw-r--r-- | src/armnnDeserializer/Deserializer.cpp | 41 | ||||
-rw-r--r-- | src/armnnDeserializer/Deserializer.hpp | 1 | ||||
-rw-r--r-- | src/armnnDeserializer/DeserializerSupport.md | 1 |
3 files changed, 43 insertions, 0 deletions
diff --git a/src/armnnDeserializer/Deserializer.cpp b/src/armnnDeserializer/Deserializer.cpp index 8572023fc4..f8ec2e79cf 100644 --- a/src/armnnDeserializer/Deserializer.cpp +++ b/src/armnnDeserializer/Deserializer.cpp @@ -188,6 +188,7 @@ m_ParserFunctions(Layer_MAX+1, &Deserializer::ParseUnsupportedLayer) m_ParserFunctions[Layer_AbsLayer] = &Deserializer::ParseAbs; m_ParserFunctions[Layer_ActivationLayer] = &Deserializer::ParseActivation; m_ParserFunctions[Layer_AdditionLayer] = &Deserializer::ParseAdd; + m_ParserFunctions[Layer_ArgMinMaxLayer] = &Deserializer::ParseArgMinMax; m_ParserFunctions[Layer_BatchToSpaceNdLayer] = &Deserializer::ParseBatchToSpaceNd; m_ParserFunctions[Layer_BatchNormalizationLayer] = &Deserializer::ParseBatchNormalization; m_ParserFunctions[Layer_ConcatLayer] = &Deserializer::ParseConcat; @@ -244,6 +245,8 @@ Deserializer::LayerBaseRawPtr Deserializer::GetBaseLayer(const GraphPtr& graphPt return graphPtr->layers()->Get(layerIndex)->layer_as_ActivationLayer()->base(); case Layer::Layer_AdditionLayer: return graphPtr->layers()->Get(layerIndex)->layer_as_AdditionLayer()->base(); + case Layer::Layer_ArgMinMaxLayer: + return graphPtr->layers()->Get(layerIndex)->layer_as_ArgMinMaxLayer()->base(); case Layer::Layer_BatchToSpaceNdLayer: return graphPtr->layers()->Get(layerIndex)->layer_as_BatchToSpaceNdLayer()->base(); case Layer::Layer_BatchNormalizationLayer: @@ -401,6 +404,18 @@ armnn::ActivationFunction ToActivationFunction(armnnSerializer::ActivationFuncti } } +armnn::ArgMinMaxFunction ToArgMinMaxFunction(armnnSerializer::ArgMinMaxFunction function) +{ + switch (function) + { + case armnnSerializer::ArgMinMaxFunction::ArgMinMaxFunction_Max: + return armnn::ArgMinMaxFunction::Max; + case armnnSerializer::ArgMinMaxFunction::ArgMinMaxFunction_Min: + default: + return armnn::ArgMinMaxFunction::Min; + } +} + armnn::ResizeMethod ToResizeMethod(armnnSerializer::ResizeMethod method) { switch (method) @@ -922,6 +937,32 @@ void Deserializer::ParseAdd(GraphPtr graph, unsigned int layerIndex) RegisterOutputSlots(graph, layerIndex, layer); } +void Deserializer::ParseArgMinMax(GraphPtr graph, unsigned int layerIndex) +{ + CHECK_LAYERS(graph, 0, layerIndex); + auto inputs = GetInputs(graph, layerIndex); + CHECK_LOCATION(); + CHECK_VALID_SIZE(inputs.size(), 1); + + auto outputs = GetOutputs(graph, layerIndex); + CHECK_VALID_SIZE(outputs.size(), 1); + + auto serializerLayer = graph->layers()->Get(layerIndex)->layer_as_ArgMinMaxLayer(); + auto serializerDescriptor = serializerLayer->descriptor(); + + armnn::ArgMinMaxDescriptor descriptor; + descriptor.m_Function = ToArgMinMaxFunction(serializerDescriptor->function()); + descriptor.m_Axis = serializerDescriptor->axis(); + auto layerName = GetLayerName(graph, layerIndex); + IConnectableLayer* layer = m_Network->AddArgMinMaxLayer(descriptor, layerName.c_str()); + + armnn::TensorInfo outputTensorInfo = ToTensorInfo(outputs[0]); + layer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo); + + RegisterInputSlots(graph, layerIndex, layer); + RegisterOutputSlots(graph, layerIndex, layer); +} + void Deserializer::ParseBatchToSpaceNd(GraphPtr graph, unsigned int layerIndex) { CHECK_LAYERS(graph, 0, layerIndex); diff --git a/src/armnnDeserializer/Deserializer.hpp b/src/armnnDeserializer/Deserializer.hpp index 9ec59fba7a..f7743bcf5b 100644 --- a/src/armnnDeserializer/Deserializer.hpp +++ b/src/armnnDeserializer/Deserializer.hpp @@ -80,6 +80,7 @@ private: void ParseAbs(GraphPtr graph, unsigned int layerIndex); void ParseActivation(GraphPtr graph, unsigned int layerIndex); void ParseAdd(GraphPtr graph, unsigned int layerIndex); + void ParseArgMinMax(GraphPtr graph, unsigned int layerIndex); void ParseBatchToSpaceNd(GraphPtr graph, unsigned int layerIndex); void ParseBatchNormalization(GraphPtr graph, unsigned int layerIndex); void ParseConcat(GraphPtr graph, unsigned int layerIndex); diff --git a/src/armnnDeserializer/DeserializerSupport.md b/src/armnnDeserializer/DeserializerSupport.md index c780071461..2fd706d9a7 100644 --- a/src/armnnDeserializer/DeserializerSupport.md +++ b/src/armnnDeserializer/DeserializerSupport.md @@ -9,6 +9,7 @@ The Arm NN SDK Deserialize parser currently supports the following layers: * Abs * Activation * Addition +* ArgMinMax * BatchToSpaceNd * BatchNormalization * Concat |