IVGCVSW-6417: Catch AddFullyConnected API error when weights TensorInfo isn't set

  * Updated code in Graph.cpp InferTensorInfos() to be more descriptive.
  * Added method VerifyConstantLayerSetTensorInfo() in Graph.cpp/hpp
    to error when ConstantLayer TensorInfo is not set.
  * Updated Optimize() in Network.cpp to call VerifyConstantLayerSetTensorInfo().
  * Added unit test with ConstantLayer TensorInfo not
    set to catch error in VerifyConstantLayerSetTensorInfo().
  * Added comments around method VerifyConstantLayerSetTensorInfo().

Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Change-Id: I366596243f7c5823676222e2d0cce1335bc8c325
diff --git a/src/armnn/Network.cpp b/src/armnn/Network.cpp
index a39b6b1..39af10f 100644
--- a/src/armnn/Network.cpp
+++ b/src/armnn/Network.cpp
@@ -1576,6 +1576,9 @@
         throw InvalidArgumentException("BFloat16 and Float16 optimization cannot be enabled at the same time.");
     }
 
+    // Ensure TensorInfo is set on all output slots of ConstantLayers in the graph
+    inNetwork.pNetworkImpl->GetGraph().VerifyConstantLayerSetTensorInfo();
+
     std::unique_ptr<Graph> graph = std::make_unique<Graph>(inNetwork.pNetworkImpl->GetGraph());
 
     auto optNet = IOptimizedNetworkPtr(new IOptimizedNetwork(std::move(graph), options.m_ModelOptions),