IVGCVSW-6145 ConstTensorsAsInput: Optimizer Fix - GetConstantTensorsByRef

 * Add functionality to check for ConstantTensorsAsInputs to GetConstantTensorsByRef
 * Reorder optimizations so RedirectMembersToConstantInputs occurs after
   Conversion of Constants
 * Ensure graph is in topological order after loading in OptimizedNet
 * Fixed test to check release of m_LayerOutputs.

Signed-off-by: Francis Murtagh <francis.murtagh@arm.com>
Change-Id: I7cff50798d7217e8ea0d2f9b153eabd10174a566
diff --git a/src/backends/backendsCommon/test/LayerReleaseConstantDataTest.cpp b/src/backends/backendsCommon/test/LayerReleaseConstantDataTest.cpp
index 5ceb8ae..abfb621 100644
--- a/src/backends/backendsCommon/test/LayerReleaseConstantDataTest.cpp
+++ b/src/backends/backendsCommon/test/LayerReleaseConstantDataTest.cpp
@@ -108,7 +108,6 @@
     TensorInfo biasInfo = biasLayer->m_LayerOutput->GetTensorInfo();
     biasInfo.SetConstant();
 
-
     weightsLayer->GetOutputSlot(0).SetTensorInfo(weightsInfo);
     biasLayer->GetOutputSlot(0).SetTensorInfo(biasInfo);
 
@@ -123,15 +122,15 @@
     Connect(layer, output, TensorInfo({ 2, 2, 2, 10 }, armnn::DataType::Float32));
 
     // check the constants that they are not NULL
-    CHECK(layer->m_Weight != nullptr);
-    CHECK(layer->m_Bias != nullptr);
+    CHECK(weightsLayer->m_LayerOutput != nullptr);
+    CHECK(biasLayer->m_LayerOutput != nullptr);
 
     // free up the constants..
     layer->ReleaseConstantData();
 
     // check the constants that they are NULL now
-    CHECK(layer->m_Weight == nullptr);
-    CHECK(layer->m_Bias == nullptr);
+    CHECK(weightsLayer->m_LayerOutput == nullptr);
+    CHECK(biasLayer->m_LayerOutput == nullptr);
 }
 
 TEST_CASE("ReleaseDepthwiseConvolution2dLayerConstantDataTest")