From 7515d0730acc926316886a85401bcd36f640627e Mon Sep 17 00:00:00 2001 From: Matthew Sloyan Date: Wed, 16 Dec 2020 12:50:01 +0000 Subject: IVGCVSW-5614 Enable Hard Swish and Elu activations * Enabled Hard Swish and Elu in TfLiteDelegate * Added support for Elu in TfLiteParser Signed-off-by: Matthew Sloyan Change-Id: If09321b58568a98e14cabce610a1586556da041e --- delegate/src/Activation.hpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'delegate/src/Activation.hpp') diff --git a/delegate/src/Activation.hpp b/delegate/src/Activation.hpp index b50854aca5..5f14e2c45c 100644 --- a/delegate/src/Activation.hpp +++ b/delegate/src/Activation.hpp @@ -49,21 +49,14 @@ TfLiteStatus VisitActivationOperator(DelegateData& delegateData, const TfLiteTensor* tfLiteTensors = tfLiteContext->tensors; const TfLiteTensor& tfLiteInputTensor = tfLiteTensors[tfLiteNode->inputs->data[0]]; - if (IsDynamicTensor(tfLiteInputTensor)) + if (!IsValid(tfLiteContext, tfLiteInputTensor, operatorCode, nodeIndex)) { - TF_LITE_MAYBE_KERNEL_LOG( - tfLiteContext, - "TfLiteArmnnDelegate: Dynamic input tensors are not supported in node #%d: ", - nodeIndex); return kTfLiteError; } + const TfLiteTensor& tfLiteOutputTensor = tfLiteTensors[tfLiteNode->outputs->data[0]]; - if (IsDynamicTensor(tfLiteOutputTensor)) + if (!IsValid(tfLiteContext, tfLiteOutputTensor, operatorCode, nodeIndex)) { - TF_LITE_MAYBE_KERNEL_LOG( - tfLiteContext, - "TfLiteArmnnDelegate: Dynamic output tensors are not supported in node #%d: ", - nodeIndex); return kTfLiteError; } @@ -96,6 +89,17 @@ TfLiteStatus VisitActivationOperator(DelegateData& delegateData, activationDesc.m_B = 1.0f; break; } + case kTfLiteBuiltinElu: + { + activationDesc.m_Function = armnn::ActivationFunction::Elu; + activationDesc.m_A = 1.0f; + break; + } + case kTfLiteBuiltinHardSwish: + { + activationDesc.m_Function = armnn::ActivationFunction::HardSwish; + break; + } default: { return kTfLiteError; -- cgit v1.2.1