aboutsummaryrefslogtreecommitdiff
path: root/delegate
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2022-01-14 12:56:35 +0000
committerTeresaARM <teresa.charlinreyes@arm.com>2022-01-18 15:15:58 +0000
commit529195f3ae752192d5f205345235bf537f472cbc (patch)
tree2ee9dba45e0c181138725607133c6f4bf1a6828a /delegate
parent611c7fb97412230d5cefee047081455fb60db06c (diff)
downloadarmnn-529195f3ae752192d5f205345235bf537f472cbc.tar.gz
MLCE-736 'Adding support for TfLite Models'
* Added constant input supports for Pack/Stack, Concatenation operators * Added Int32 support to Pack/Stack operator on CpuRef * Removed unsupported operator from TfLite Delegate Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I64203e174300d23eedeb22bddefe07e931c4eff3
Diffstat (limited to 'delegate')
-rw-r--r--delegate/src/Control.hpp38
-rw-r--r--delegate/src/Pack.hpp10
-rw-r--r--delegate/src/armnn_delegate.cpp6
3 files changed, 22 insertions, 32 deletions
diff --git a/delegate/src/Control.hpp b/delegate/src/Control.hpp
index a9645149b4..f20b9f0cc3 100644
--- a/delegate/src/Control.hpp
+++ b/delegate/src/Control.hpp
@@ -72,20 +72,8 @@ TfLiteStatus VisitConcatenationOperator(DelegateData& delegateData,
for (unsigned int i = 0; i < numInputs; ++i)
{
const TfLiteTensor& tfLiteInputTensor = tfLiteTensors[tfLiteNode->inputs->data[i]];
- if(!IsValid(&tfLiteInputTensor))
+ if (!IsValid(tfLiteContext, tfLiteInputTensor, tfLiteConcatOperatorCode, nodeIndex))
{
- TF_LITE_MAYBE_KERNEL_LOG(
- tfLiteContext,
- "TfLiteArmnnDelegate: Invalid input tensor in operator #%d node #%d: ",
- tfLiteConcatOperatorCode, nodeIndex);
- return kTfLiteError;
- }
- if (IsDynamicTensor(tfLiteInputTensor))
- {
- TF_LITE_MAYBE_KERNEL_LOG(
- tfLiteContext,
- "TfLiteArmnnDelegate: Dynamic input tensors are not supported in operator #%d node #%d: ",
- tfLiteConcatOperatorCode, nodeIndex);
return kTfLiteError;
}
@@ -101,20 +89,8 @@ TfLiteStatus VisitConcatenationOperator(DelegateData& delegateData,
[](armnn::TensorInfo& t)->const armnn::TensorInfo*{ return &t; });
const TfLiteTensor& tfLiteOutputTensor = tfLiteTensors[tfLiteNode->outputs->data[0]];
- if(!IsValid(&tfLiteOutputTensor))
+ if (!IsValid(tfLiteContext, tfLiteOutputTensor, tfLiteConcatOperatorCode, nodeIndex))
{
- TF_LITE_MAYBE_KERNEL_LOG(
- tfLiteContext,
- "TfLiteArmnnDelegate: Invalid output tensor in operator #%d node #%d: ",
- tfLiteConcatOperatorCode, nodeIndex);
- return kTfLiteError;
- }
- if (IsDynamicTensor(tfLiteOutputTensor))
- {
- TF_LITE_MAYBE_KERNEL_LOG(
- tfLiteContext,
- "TfLiteArmnnDelegate: Dynamic output tensors are not supported in operator #%d node #%d: ",
- tfLiteConcatOperatorCode, nodeIndex);
return kTfLiteError;
}
@@ -165,6 +141,16 @@ TfLiteStatus VisitConcatenationOperator(DelegateData& delegateData,
armnn::IConnectableLayer* concatenationLayer = delegateData.m_Network->AddConcatLayer(concatDescriptor);
ARMNN_ASSERT(concatenationLayer != nullptr);
+ // Connect the Constant Inputs
+ auto inputsTensorsProcess = ProcessInputs(concatenationLayer,
+ delegateData,
+ tfLiteContext,
+ tfLiteNode);
+ if (inputsTensorsProcess == kTfLiteError)
+ {
+ return inputsTensorsProcess;
+ }
+
armnn::IOutputSlot& outputSlot = concatenationLayer->GetOutputSlot(0);
outputSlot.SetTensorInfo(outputTensorInfo);
Connect(concatenationLayer, tfLiteNode, delegateData);
diff --git a/delegate/src/Pack.hpp b/delegate/src/Pack.hpp
index 59851cd637..5e93ba3f2a 100644
--- a/delegate/src/Pack.hpp
+++ b/delegate/src/Pack.hpp
@@ -99,6 +99,16 @@ TfLiteStatus VisitPackOperator(DelegateData& delegateData,
armnn::IConnectableLayer* layer = delegateData.m_Network->AddStackLayer(desc);
ARMNN_ASSERT(layer != nullptr);
+ // Connect the Constant Inputs
+ auto inputsTensorsProcess = ProcessInputs(layer,
+ delegateData,
+ tfLiteContext,
+ tfLiteNode);
+ if (inputsTensorsProcess == kTfLiteError)
+ {
+ return inputsTensorsProcess;
+ }
+
armnn::IOutputSlot& outputSlot = layer->GetOutputSlot(0);
outputSlot.SetTensorInfo(outputTensorInfo);
diff --git a/delegate/src/armnn_delegate.cpp b/delegate/src/armnn_delegate.cpp
index b18d234d69..ed19b72787 100644
--- a/delegate/src/armnn_delegate.cpp
+++ b/delegate/src/armnn_delegate.cpp
@@ -623,12 +623,6 @@ TfLiteStatus ArmnnSubgraph::VisitNode(DelegateData& delegateData,
tfLiteNode,
nodeIndex,
kTfLiteBuiltinGather);
- case kTfLiteBuiltinGatherNd:
- return VisitGatherOperator(delegateData,
- tfLiteContext,
- tfLiteNode,
- nodeIndex,
- kTfLiteBuiltinGatherNd);
case kTfLiteBuiltinGreater:
return VisitComparisonOperator(delegateData,
tfLiteContext,