From 998517647d699d602e36f06b40d3f1d1ddaae7be Mon Sep 17 00:00:00 2001 From: Nina Drozd Date: Tue, 9 Apr 2019 09:37:38 +0100 Subject: IVGCVSW-2845: Add TfLite Parser support for TanH activation layer * Added ParseTanH in TfLiteParser * Added testcase for parsing TanH activation in Activations.cpp * Added new supported TanH operator in TensorflowLiteSupport.md Signed-off-by: Nina Drozd Change-Id: Ie60f38994d76b077f86828c21c57381bdeeaeb5a --- src/armnnTfLiteParser/TfLiteParser.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/armnnTfLiteParser/TfLiteParser.cpp') diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp index c00c2188a9..5c5618b865 100644 --- a/src/armnnTfLiteParser/TfLiteParser.cpp +++ b/src/armnnTfLiteParser/TfLiteParser.cpp @@ -465,6 +465,7 @@ TfLiteParser::TfLiteParser() m_ParserFunctions[tflite::BuiltinOperator_MEAN] = &TfLiteParser::ParseMean; m_ParserFunctions[tflite::BuiltinOperator_PAD] = &TfLiteParser::ParsePad; m_ParserFunctions[tflite::BuiltinOperator_SPLIT] = &TfLiteParser::ParseSplit; + m_ParserFunctions[tflite::BuiltinOperator_TANH] = &TfLiteParser::ParseTanH; } void TfLiteParser::ResetParser() @@ -1478,6 +1479,11 @@ void TfLiteParser::ParseLogistic(size_t subgraphIndex, size_t operatorIndex) ParseActivation(subgraphIndex,operatorIndex,ActivationFunction::Sigmoid); } +void TfLiteParser::ParseTanH(size_t subgraphIndex, size_t operatorIndex) +{ + ParseActivation(subgraphIndex,operatorIndex,ActivationFunction::TanH); +} + void TfLiteParser::ParseActivation(size_t subgraphIndex, size_t operatorIndex, ActivationFunction activationType) { @@ -1514,6 +1520,13 @@ void TfLiteParser::ParseActivation(size_t subgraphIndex, size_t operatorIndex, A layerName += str(boost::format("SIGMOID:%1%:%2%") % subgraphIndex % operatorIndex); break; } + case ActivationFunction::TanH: + { + layerName += str(boost::format("TANH:%1%:%2%") % subgraphIndex % operatorIndex); + activationDesc.m_A = 1.0f; + activationDesc.m_B = 1.0f; + break; + } default: { throw ParseException( -- cgit v1.2.1