diff options
author | mathad01 <matthew.haddon@arm.com> | 2021-04-20 16:12:45 +0100 |
---|---|---|
committer | Jan Eilers <jan.eilers@arm.com> | 2021-04-22 08:21:43 +0000 |
commit | bf7edb619cd5cf0ae84342299abe7c27f3ba6e7d (patch) | |
tree | aace117c1b6de99b257552be74b8d8dc2b39718d /src/armnnTfLiteParser/TfLiteParser.cpp | |
parent | e11e63d749b0909f13f9a39c8d34ef5523255170 (diff) | |
download | armnn-bf7edb619cd5cf0ae84342299abe7c27f3ba6e7d.tar.gz |
IVGCVSW-5418 ExecuteNetwork test for MobileBERT
* Removed check in TfLiteParser and Delegate that requires both weights
and biases to be constant or non-constant simultaneously
* Updated TfLiteParser FullyConnected layer test to properly use
non-constant weights
* MobileBERT Float32 model now runs on TfLiteParser
Signed-off-by: mathad01 <matthew.haddon@arm.com>
Change-Id: I1d75eea466caa90cd695ad353160362df2f69483
Diffstat (limited to 'src/armnnTfLiteParser/TfLiteParser.cpp')
-rw-r--r-- | src/armnnTfLiteParser/TfLiteParser.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp index 9b1fa9075c..5070d5b22f 100644 --- a/src/armnnTfLiteParser/TfLiteParser.cpp +++ b/src/armnnTfLiteParser/TfLiteParser.cpp @@ -2374,15 +2374,6 @@ void TfLiteParserImpl::ParseFullyConnected(size_t subgraphIndex, size_t operator desc.m_ConstantWeights = IsConstTensor(inputs[1]); - // Either both weights and biases need to be inputs or both weights and biases need to be constant - if (inputs.size() == 3 && desc.m_ConstantWeights != IsConstTensor(inputs[2])) - { - throw ParseException( - fmt::format("Weights and bias are not compatible." - "Node {}", - CHECK_LOCATION().AsString())); - } - auto inputTensorIndexes = AsUnsignedVector(GetInputTensorIds(m_Model, subgraphIndex, operatorIndex)); std::vector<unsigned int> tensorIndexesToRegister = {inputTensorIndexes[0]}; if (desc.m_ConstantWeights) @@ -3600,7 +3591,15 @@ TfLiteParserImpl::CreateConstTensorAndStoreData(TfLiteParserImpl::BufferRawPtr b bool TfLiteParserImpl::IsConstTensor(TensorRawPtr tensorPtr) { CHECK_TENSOR_PTR(tensorPtr); - return !tensorPtr->is_variable; + bool isConst = true; + + auto buffer = GetBuffer(m_Model, tensorPtr->buffer); + if (buffer->data.size() == 0) + { + isConst = false; + } + + return isConst; } |