IVGCVSW-7040 TfLiteParser fails to prepare model due to unspecified size buffer data for Slice operator.
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Change-Id: I86735faf8d57168a63ca6657f281ec03b90f7235
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp
index 0304203..a26f3e5 100644
--- a/src/armnnTfLiteParser/TfLiteParser.cpp
+++ b/src/armnnTfLiteParser/TfLiteParser.cpp
@@ -1841,8 +1841,14 @@
armnn::TensorInfo sizeTensorInfo = ToTensorInfo(inputs[2]);
BufferRawPtr sizeBufferPtr = GetBuffer(m_Model, inputs[2]->buffer);
- std::vector<int> signedSize(sizeTensorInfo.GetNumElements());
- ::memcpy(signedSize.data(), sizeBufferPtr->data.data(), sizeTensorInfo.GetNumBytes());
+ std::vector<int> signedSize(sizeTensorInfo.GetNumElements(), 1);
+
+ // if size buffer data is not specified, all contents of size vector remain as values of 1
+ if (sizeBufferPtr->data.data())
+ {
+ ::memcpy(signedSize.data(), sizeBufferPtr->data.data(), sizeTensorInfo.GetNumBytes());
+ }
+
std::vector<unsigned int> size(sizeTensorInfo.GetNumElements());
TensorInfo inputTensorInfo = ToTensorInfo(inputs[0]);