aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/armnnTfLiteParser/TfLiteParser.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp
index 030420345e..a26f3e5f04 100644
--- a/src/armnnTfLiteParser/TfLiteParser.cpp
+++ b/src/armnnTfLiteParser/TfLiteParser.cpp
@@ -1841,8 +1841,14 @@ void TfLiteParserImpl::ParseSlice(size_t subgraphIndex, size_t operatorIndex)
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]);