IVGCVSW-5882 Turn off Bias when data location equals -1

 * Fix bug in stack layer which causes some models to seg fault.
 * Turn off bias input data if data location in TfLite file is set
to -1.

Signed-off-by: mathad01 <matthew.haddon@arm.com>
Change-Id: I0db8cfe04874979382edcf2bed336339700e3538
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp
index 5070d5b..7c81a8f 100644
--- a/src/armnnTfLiteParser/TfLiteParser.cpp
+++ b/src/armnnTfLiteParser/TfLiteParser.cpp
@@ -329,6 +329,11 @@
     result.reserve(in.size());
     for (auto & i : in)
     {
+        // If the location of the input data is -1 then the input should be ignored.
+        if (i == -1)
+        {
+            continue;
+        }
         result.push_back(CHECKED_NON_NEGATIVE(i));
     }
     return result;
@@ -3359,11 +3364,19 @@
     const auto & operatorPtr = subgraphPtr->operators[operatorIndex];
 
     size_t inputCount = operatorPtr->inputs.size();
-    TensorRawPtrVector result(inputCount);
+    TensorRawPtrVector result;
     for (size_t i=0; i<inputCount; ++i)
     {
-        uint32_t inputId = CHECKED_NON_NEGATIVE(operatorPtr->inputs[i]);
-        result[i] = subgraphPtr->tensors[inputId].get();
+        // If the input location is -1 then assume input is turned off.
+        if (operatorPtr->inputs[i] == -1)
+        {
+            continue;
+        }
+        else
+        {
+            uint32_t inputId = CHECKED_NON_NEGATIVE(operatorPtr->inputs[i]);
+            result.push_back(subgraphPtr->tensors[inputId].get());
+        }
     }
     return result;
 }