MLCE-1092 Added layerNames to opaque delegate
* All layers added through the opaque delegate will have a name that
includes the nodeIndex from the tflite model.
* Added utilities to OpaqueDelegateUtils to get the names for the layers.
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: Iadcc21646d0b6fcc2c524d6239211ad3af6b6577
diff --git a/delegate/opaque/src/Redefine.hpp b/delegate/opaque/src/Redefine.hpp
index ce90af0..5ce7a3d 100644
--- a/delegate/opaque/src/Redefine.hpp
+++ b/delegate/opaque/src/Redefine.hpp
@@ -73,7 +73,8 @@
}
// Add a Cast layer
- armnn::IConnectableLayer* layer = delegateData.m_Network->AddCastLayer();
+ auto layerName = GetName(armnn::LayerType::Cast, nodeIndex);
+ armnn::IConnectableLayer* layer = delegateData.m_Network->AddCastLayer(layerName.c_str());
layer->SetBackendId(setBackend);
ARMNN_ASSERT(layer != nullptr);
@@ -81,7 +82,7 @@
outputSlot.SetTensorInfo(outputTensorInfo);
// try to connect the Constant Inputs if there are any
- if (ProcessInputs(layer, delegateData, tfLiteContext, tfLiteNode) != kTfLiteOk)
+ if (ProcessInputs(layer, delegateData, tfLiteContext, tfLiteNode, nodeIndex) != kTfLiteOk)
{
return kTfLiteError;
}
@@ -242,7 +243,8 @@
return isSupported ? kTfLiteOk : kTfLiteError;
}
- armnn::IConnectableLayer* layer = delegateData.m_Network->AddReshapeLayer(reshapeDesc);
+ auto layerName = GetName(armnn::LayerType::Reshape, nodeIndex);
+ armnn::IConnectableLayer* layer = delegateData.m_Network->AddReshapeLayer(reshapeDesc, layerName.c_str());
layer->SetBackendId(setBackend);
ARMNN_ASSERT(layer != nullptr);
@@ -250,7 +252,7 @@
outputSlot.SetTensorInfo(outputTensorInfo);
// try to connect the Constant Inputs if there are any
- if(ProcessInputs(layer,delegateData, tfLiteContext, tfLiteNode) != kTfLiteOk )
+ if (ProcessInputs(layer, delegateData, tfLiteContext, tfLiteNode, nodeIndex) != kTfLiteOk)
{
return kTfLiteError;
}
@@ -350,7 +352,8 @@
return isSupported ? kTfLiteOk : kTfLiteError;
}
- armnn::IConnectableLayer* layer = delegateData.m_Network->AddReshapeLayer(reshapeDesc);
+ auto layerName = GetName(armnn::LayerType::Reshape, nodeIndex, "Squeeze");
+ armnn::IConnectableLayer* layer = delegateData.m_Network->AddReshapeLayer(reshapeDesc, layerName.c_str());
layer->SetBackendId(setBackend);
ARMNN_ASSERT(layer != nullptr);
@@ -358,7 +361,7 @@
outputSlot.SetTensorInfo(outputTensorInfo);
// try to connect the Constant Inputs if there are any
- if(ProcessInputs(layer, delegateData, tfLiteContext, tfLiteNode) != kTfLiteOk)
+ if (ProcessInputs(layer, delegateData, tfLiteContext, tfLiteNode, nodeIndex) != kTfLiteOk)
{
return kTfLiteError;
}
@@ -478,7 +481,8 @@
return isSupported ? kTfLiteOk : kTfLiteError;
}
- armnn::IConnectableLayer* layer = delegateData.m_Network->AddReshapeLayer(reshapeDesc);
+ auto layerName = GetName(armnn::LayerType::Reshape, nodeIndex, "ExpandDims");
+ armnn::IConnectableLayer* layer = delegateData.m_Network->AddReshapeLayer(reshapeDesc, layerName.c_str());
layer->SetBackendId(setBackend);
ARMNN_ASSERT(layer != nullptr);
@@ -487,7 +491,7 @@
outputSlot.SetTensorInfo(outputTensorInfo);
// try to connect the Constant Inputs if there are any
- if(ProcessInputs(layer, delegateData, tfLiteContext, tfLiteNode) != kTfLiteOk)
+ if (ProcessInputs(layer, delegateData, tfLiteContext, tfLiteNode, nodeIndex) != kTfLiteOk)
{
return kTfLiteError;
}