MLCE-278-IVGCVSW-5530 FusedActivation issues

 * GetOverriddenDataType was returning incorrect quantization data
 * Optimized CpuAcc and GpuAcc SubGraphs fail validation on debug versions
   of ArmNN

Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: Ie97935cc2af67bd9aeebc94b63dafa458bd1aa8c
diff --git a/src/backends/cl/ClBackend.cpp b/src/backends/cl/ClBackend.cpp
index 57a5851..80c7969 100644
--- a/src/backends/cl/ClBackend.cpp
+++ b/src/backends/cl/ClBackend.cpp
@@ -148,7 +148,16 @@
 
     auto it = subgraph.end();
     bool isFastMathEnabled = false;
+    std::map<LayerGuid, Layer*> untouched;
 
+    while (it != subgraph.begin())
+    {
+        --it;
+        Layer& base = **it;
+        untouched.insert({base.GetGuid(), &base});
+    }
+
+    it = subgraph.end();
 #if defined(ARMCOMPUTECL_ENABLED)
     IBackendInternal::IBackendSpecificModelContextPtr modelContextPtr = CreateBackendSpecificModelContext(modelOptions);
 
@@ -161,7 +170,6 @@
         }
     }
 #endif
-
     while (it != subgraph.begin())
     {
         --it;
@@ -199,9 +207,7 @@
 
                                 if (baseLayer->GetParameters().m_BiasEnabled)
                                 {
-                                    biases = GetOverriddenDataType(baseLayer->m_Bias->GetTensorInfo(),
-                                            GetOptionalBiasTypeFromWeightsType(
-                                                    baseLayer->m_Weight->GetTensorInfo().GetDataType()));
+                                    biases = baseLayer->m_Bias->GetTensorInfo();
                                 }
 
                                 arm_compute::Status status = ClConvolution2dWorkloadValidate(
@@ -220,6 +226,8 @@
                                                                                       activationLayer,
                                                                                       activationDesc,
                                                                                       name);
+                                    untouched.erase(baseLayer->GetGuid());
+                                    untouched.erase(activationLayer->GetGuid());
                                 }
                             }
                             else if (base.GetType() == LayerType::DepthwiseConvolution2d)
@@ -231,9 +239,7 @@
 
                                 if (baseLayer->GetParameters().m_BiasEnabled)
                                 {
-                                    biases = GetOverriddenDataType(baseLayer->m_Bias->GetTensorInfo(),
-                                            GetOptionalBiasTypeFromWeightsType(
-                                                    baseLayer->m_Weight->GetTensorInfo().GetDataType()));
+                                    biases = baseLayer->m_Bias->GetTensorInfo();
                                 }
 
                                 arm_compute::Status status = ClDepthwiseConvolutionWorkloadValidate(
@@ -251,6 +257,8 @@
                                                                                                activationLayer,
                                                                                                activationDesc,
                                                                                                name);
+                                    untouched.erase(baseLayer->GetGuid());
+                                    untouched.erase(activationLayer->GetGuid());
                                 }
                             }
                             else if (base.GetType() == LayerType::FullyConnected)
@@ -272,6 +280,8 @@
                                                                                        activationLayer,
                                                                                        activationDesc,
                                                                                        name);
+                                    untouched.erase(baseLayer->GetGuid());
+                                    untouched.erase(activationLayer->GetGuid());
                                 }
                             }
                             else if (base.GetType() == LayerType::BatchNormalization)
@@ -302,6 +312,8 @@
                                     replacementLayer->m_Gamma    = std::move(baseLayer->m_Gamma);
                                     replacementLayer->m_Mean     = std::move(baseLayer->m_Mean);
                                     replacementLayer->m_Variance = std::move(baseLayer->m_Variance);
+                                    untouched.erase(baseLayer->GetGuid());
+                                    untouched.erase(activationLayer->GetGuid());
                                 }
                             }
                             else if (base.GetType() == LayerType::Addition)
@@ -321,6 +333,8 @@
                                                                               activationLayer,
                                                                               activationDesc,
                                                                               name);
+                                    untouched.erase(baseLayer->GetGuid());
+                                    untouched.erase(activationLayer->GetGuid());
                                 }
                             }
                             else if (base.GetType() == LayerType::Division)
@@ -340,6 +354,8 @@
                                                                               activationLayer,
                                                                               activationDesc,
                                                                               name);
+                                    untouched.erase(baseLayer->GetGuid());
+                                    untouched.erase(activationLayer->GetGuid());
                                 }
                             }
                             else if (base.GetType() == LayerType::Multiplication)
@@ -359,6 +375,8 @@
                                                                                     activationLayer,
                                                                                     activationDesc,
                                                                                     name);
+                                    untouched.erase(baseLayer->GetGuid());
+                                    untouched.erase(activationLayer->GetGuid());
                                 }
                             }
                             else if (base.GetType() == LayerType::Subtraction)
@@ -378,6 +396,8 @@
                                                                                  activationLayer,
                                                                                  activationDesc,
                                                                                  name);
+                                    untouched.erase(baseLayer->GetGuid());
+                                    untouched.erase(activationLayer->GetGuid());
                                 }
                             }
                         }
@@ -386,11 +406,15 @@
             }
         }
     }
-    // end each optimization
+
     if (optimizationViews.GetSubstitutions().empty())
     {
         optimizationViews.AddUntouchedSubgraph(SubgraphView(subgraph));
     }
+    else
+    {
+        ReportUntouchedLayers(optimizationViews, untouched);
+    }
 
     return optimizationViews;
 }