From 077cddbe9e956c6740557a9add499385f235c384 Mon Sep 17 00:00:00 2001 From: Teresa Charlin Date: Fri, 15 Sep 2023 15:19:21 +0100 Subject: IVGCVSW-8055 Add support for GELU activation function. * Add support to CpuRef, CpuAcc and GpuAcc * Add support to tflite parser, classic and opaque tflite delegates * Add support to serializer and deserializer * Add Unit tests Signed-off-by: Teresa Charlin Change-Id: Ibc60ef2ef2a051e6d9af6e15d24c46316ec19de4 --- delegate/opaque/src/Activation.hpp | 8 ++++++++ delegate/opaque/src/armnn_delegate.cpp | 6 ++++++ 2 files changed, 14 insertions(+) (limited to 'delegate/opaque') diff --git a/delegate/opaque/src/Activation.hpp b/delegate/opaque/src/Activation.hpp index dd9c2f68bc..ad242e5799 100644 --- a/delegate/opaque/src/Activation.hpp +++ b/delegate/opaque/src/Activation.hpp @@ -24,6 +24,9 @@ std::string GetLayerName(armnn::ActivationFunction activationFunction) case armnn::ActivationFunction::Elu: layerName += " ELU"; break; + case armnn::ActivationFunction::Gelu: + layerName += " GELU"; + break; case armnn::ActivationFunction::HardSwish: layerName += " HARD_SWISH"; break; @@ -175,6 +178,11 @@ TfLiteStatus VisitActivationOperator(DelegateData& delegateData, activationDesc.m_A = leakyReluParameters->alpha; break; } + case kTfLiteBuiltinGelu: + { + activationDesc.m_Function = armnn::ActivationFunction::Gelu; + break; + } default: { return kTfLiteError; diff --git a/delegate/opaque/src/armnn_delegate.cpp b/delegate/opaque/src/armnn_delegate.cpp index 08b1504efb..6abf7398cc 100644 --- a/delegate/opaque/src/armnn_delegate.cpp +++ b/delegate/opaque/src/armnn_delegate.cpp @@ -808,6 +808,12 @@ TfLiteStatus ArmnnSubgraph::VisitNode(DelegateData& delegateData, tfLiteNode, nodeIndex, kTfLiteBuiltinGatherNd); + case kTfLiteBuiltinGelu: + return VisitActivationOperator(delegateData, + tfLiteContext, + tfLiteNode, + nodeIndex, + kTfLiteBuiltinGelu); case kTfLiteBuiltinGreater: return VisitComparisonOperator(delegateData, tfLiteContext, -- cgit v1.2.1