Optimize the calling of IsLayerSupported().

  * Done as part of 22.11/23.02 innovation days.
  * IsLayerSupported() is called in model prepare (delegate, android-nn-driver and shim/support_library)
    and again in ArmNN once model otimization is performed.
  * From calling IsLayerSupported() the first time, we should know that the layers are supported
    and what backend they are supported on.
  * Solution is to set the BackendId of the IConnectableLayer when IsLayerSupported() is called the first time,
  * In the Optimize() function we then check if the backend is set. If so, we do not call IsLayerSupported() again.
  * In the case a layer that is supported gets optimized, then the BackendId of that layer get set to "Unknown"
    for the new optimized layer and IsLayerSupported() will get called on the newly optimized layer.
  * Includes bug fix IVGCVSW-7213 for Android Mean FP16 CpuAcc tests. Also related to bug IVGCVSW-7211.

Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Change-Id: I7a7820d0cdb079ffb5a3a2e0c44e252f652df53b
diff --git a/delegate/src/Slice.hpp b/delegate/src/Slice.hpp
index cbcb45e..d5712ae 100644
--- a/delegate/src/Slice.hpp
+++ b/delegate/src/Slice.hpp
@@ -99,6 +99,7 @@
     const armnn::TensorInfo& outputTensorInfo = GetTensorInfoForTfLiteTensor(tfLiteOutputTensor, true);
 
     bool isSupported = false;
+    armnn::BackendId setBackend;
     auto validateFunc = [&](const armnn::TensorInfo& outInfo, bool& isSupported)
     {
         FORWARD_LAYER_SUPPORT_FUNC("SLICE",
@@ -106,6 +107,7 @@
                                    IsSliceSupported,
                                    delegateData.m_Backends,
                                    isSupported,
+                                   setBackend,
                                    inputTensorInfo,
                                    outInfo,
                                    descriptor);
@@ -117,8 +119,9 @@
         return isSupported ? kTfLiteOk : kTfLiteError;
     }
 
-    // Add a StridedSlice layer
+    // Add a Slice layer
     armnn::IConnectableLayer* layer = delegateData.m_Network->AddSliceLayer(descriptor);
+    layer->SetBackendId(setBackend);
     ARMNN_ASSERT(layer != nullptr);
 
     armnn::IOutputSlot& outputSlot = layer->GetOutputSlot(0);
@@ -129,3 +132,4 @@
 }
 
 } // namespace armnnDelegate
+