diff options
author | Jan Eilers <jan.eilers@arm.com> | 2020-06-29 16:48:44 +0100 |
---|---|---|
committer | Jan Eilers <jan.eilers@arm.com> | 2020-06-29 16:48:44 +0100 |
commit | c0761e9a82ec4d6bd4a81fda018d624659b629a7 (patch) | |
tree | 8d4dc34491014dd5bea7cca9eaeabdb85c2634e4 | |
parent | c9631100b27f327fbbc761f8472de6c62fc8c3d3 (diff) | |
download | armnn-c0761e9a82ec4d6bd4a81fda018d624659b629a7.tar.gz |
IVGCVSW-5021 Fix failure in SplitV
Signed-off-by: Jan Eilers <jan.eilers@arm.com>
Change-Id: I587f601d3e1b9ea11fbc3dc379f24c5ebdcf3cf8
-rw-r--r-- | src/armnnTfLiteParser/TfLiteParser.cpp | 15 | ||||
-rw-r--r-- | src/armnnTfLiteParser/test/SplitV.cpp | 8 |
2 files changed, 8 insertions, 15 deletions
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp index 1737da8616..7f68199368 100644 --- a/src/armnnTfLiteParser/TfLiteParser.cpp +++ b/src/armnnTfLiteParser/TfLiteParser.cpp @@ -2689,7 +2689,7 @@ void TfLiteParser::ParseSplitV(size_t subgraphIndex, size_t operatorIndex) boost::str( boost::format( "The number of dimensions: %1% for input tensors of the " - "split op cannot be greater than %2% %3%") + "SplitV op cannot be greater than %2% %3%") % inputTensorInfo.GetNumDimensions() % MaxNumOfTensorDimensions % CHECK_LOCATION().AsString())); @@ -2703,7 +2703,6 @@ void TfLiteParser::ParseSplitV(size_t subgraphIndex, size_t operatorIndex) // Set split sizes CHECK_VALID_SIZE(splitsInfo.GetNumDimensions(), 1); - std::vector<int> splitsData(0); unsigned int numSplits{0}; if(options) @@ -2720,17 +2719,11 @@ void TfLiteParser::ParseSplitV(size_t subgraphIndex, size_t operatorIndex) throw ParseException("SplitV has invalid number of splits"); } - splitsData.resize(numSplits); + std::vector<int> splitsData(numSplits); BufferRawPtr splitsBufferPtr = GetBuffer(m_Model, splitsTensor->buffer); - unsigned int idx{0}; - - for(auto& split: splitsData) - { - split = splitsBufferPtr->data[idx]; - idx++; - } + ::memcpy(splitsData.data(), splitsBufferPtr->data.data(), splitsInfo.GetNumBytes()); - idx = 0; + unsigned int idx = 0; int numInferred{0}; unsigned int inferIdx{0}; int splitSum{0}; diff --git a/src/armnnTfLiteParser/test/SplitV.cpp b/src/armnnTfLiteParser/test/SplitV.cpp index 59afeeca19..9541114d71 100644 --- a/src/armnnTfLiteParser/test/SplitV.cpp +++ b/src/armnnTfLiteParser/test/SplitV.cpp @@ -121,7 +121,7 @@ struct SplitVFixture : public ParserFlatbuffersFixture struct SimpleSplitVAxisOneFixture : SplitVFixture { SimpleSplitVAxisOneFixture() - : SplitVFixture( "[ 4, 2, 2, 2 ]", "[ 1, 3 ]", "[ 2 ]","[ ]", "2", + : SplitVFixture( "[ 4, 2, 2, 2 ]", "[ 1, 0, 0, 0, 3, 0, 0, 0 ]", "[ 2 ]","[ ]", "2", "[ 1, 2, 2, 2 ]", "[ 3, 2, 2, 2 ]", "[ 0, 0, 0, 0 ]", "FLOAT32") {} }; @@ -143,7 +143,7 @@ BOOST_FIXTURE_TEST_CASE(ParseAxisOneSplitVTwo, SimpleSplitVAxisOneFixture) struct SimpleSplitVAxisTwoFixture : SplitVFixture { SimpleSplitVAxisTwoFixture() - : SplitVFixture( "[ 2, 4, 2, 2 ]", "[ 3, 1 ]", "[ 2 ]","[ ]", "2", + : SplitVFixture( "[ 2, 4, 2, 2 ]", "[ 3, 0, 0, 0, 1, 0, 0, 0 ]", "[ 2 ]","[ ]", "2", "[ 2, 3, 2, 2 ]", "[ 2, 1, 2, 2 ]", "[ 1, 0, 0, 0 ]", "FLOAT32") {} }; @@ -165,7 +165,7 @@ BOOST_FIXTURE_TEST_CASE(ParseAxisTwoSplitVTwo, SimpleSplitVAxisTwoFixture) struct SimpleSplitVAxisThreeFixture : SplitVFixture { SimpleSplitVAxisThreeFixture() - : SplitVFixture( "[ 2, 2, 4, 2 ]", "[ 1, 3 ]", "[ 2 ]","[ ]", "2", + : SplitVFixture( "[ 2, 2, 4, 2 ]", "[ 1, 0, 0, 0, 3, 0, 0, 0 ]", "[ 2 ]","[ ]", "2", "[ 2, 2, 1, 2 ]", "[ 2, 2, 3, 2 ]", "[ 2, 0, 0, 0 ]", "FLOAT32") {} }; @@ -187,7 +187,7 @@ BOOST_FIXTURE_TEST_CASE(ParseAxisThreeSplitVTwo, SimpleSplitVAxisThreeFixture) struct SimpleSplitVAxisFourFixture : SplitVFixture { SimpleSplitVAxisFourFixture() - : SplitVFixture( "[ 2, 2, 2, 4 ]", "[ 3, 1 ]", "[ 2 ]","[ ]", "2", + : SplitVFixture( "[ 2, 2, 2, 4 ]", "[ 3, 0, 0, 0, 1, 0, 0, 0 ]", "[ 2 ]","[ ]", "2", "[ 2, 2, 2, 3 ]", "[ 2, 2, 2, 1 ]", "[ 3, 0, 0, 0 ]", "FLOAT32") {} }; |