MLCE-336 'TfLite parser and ExecuteNetwork issues'
authorSadik Armagan <sadik.armagan@arm.com>
Wed, 20 Jan 2021 12:17:00 +0000 (12:17 +0000)
committerSadik Armagan <sadik.armagan@arm.com>
Wed, 20 Jan 2021 12:17:00 +0000 (12:17 +0000)
* Report the error thrown

Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: If5e5160f43c11a284b919d76b04d9c4d53e9c56c

src/armnnTfLiteParser/TfLiteParser.cpp
tests/ExecuteNetwork/ExecuteNetwork.cpp

index 8e0fae6..a18471a 100644 (file)
@@ -2130,6 +2130,10 @@ void TfLiteParser::ParseReshape(size_t subgraphIndex, size_t operatorIndex)
             // Extract target shape from input
             auto bufferPtr = GetBuffer(m_Model, inputs[1]->buffer);
             auto values = reinterpret_cast<const int32_t*>(bufferPtr->data.data());
+            if (!values)
+            {
+                ARMNN_THROW_PARSE_EXCEPTION("Reshape operator target shape input buffer data is null");
+            }
             for (int i=0; i < inputs[1]->shape[0]; ++i)
             {
                 targetShape.push_back(values[i]);
index 6880a17..5df5dfb 100644 (file)
@@ -61,6 +61,11 @@ int TfLiteDelegateMainImpl(const ExecuteNetworkParams& params,
                              armnnDelegate::TfLiteArmnnDelegateDelete);
     // Register armnn_delegate to TfLiteInterpreter
     int status = tfLiteInterpreter->ModifyGraphWithDelegate(std::move(theArmnnDelegate));
+    if (status == kTfLiteError)
+    {
+        ARMNN_LOG(fatal) << "Could not register ArmNN TfLite Delegate to TfLiteInterpreter!";
+        return EXIT_FAILURE;
+    }
 
     std::vector<std::string>  inputBindings;
     for (const std::string& inputName: params.m_InputNames)