diff options
author | narpra01 <narumol.prangnawarat@arm.com> | 2018-12-21 18:30:00 +0000 |
---|---|---|
committer | Les Bell <les.bell@arm.com> | 2019-01-02 09:25:42 +0000 |
commit | 6f37f83a27160948fee366b9f195c52f78cb88f0 (patch) | |
tree | d09a8d5769c3ac2c8f45660d305e9a6124716310 /src/armnnTfParser/TfParser.cpp | |
parent | c48ac8c8cea1748ebfef15144f070799d4a129c3 (diff) | |
download | armnn-6f37f83a27160948fee366b9f195c52f78cb88f0.tar.gz |
IVGCVSW-2353 Ignore control inputs in TensorFlow parser
* Allow control inputs from TensorFlow graph but ignore them in ArmNN graph.
* Add utility function to test ArmNN graph structure.
* Add ArmNN graph structure tests in TensorFlow paresr to ensure that control inputs
are ignored in ArmNN graph as well as their inputs that are not used anywhere else.
Change-Id: Ib0ea0d2df85e3fc79b748fa4c9d20e0649352bc1
Diffstat (limited to 'src/armnnTfParser/TfParser.cpp')
-rw-r--r-- | src/armnnTfParser/TfParser.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/armnnTfParser/TfParser.cpp b/src/armnnTfParser/TfParser.cpp index 1a0047fce6..7f04757b75 100644 --- a/src/armnnTfParser/TfParser.cpp +++ b/src/armnnTfParser/TfParser.cpp @@ -357,7 +357,11 @@ const std::map<std::string, TfParser::OperationParsingFunction> TfParser::ms_Ope { "Minimum", &TfParser::ParseMinimum }, { "Equal", &TfParser::ParseEqual }, { "Pad", &TfParser::ParsePad }, - { "Sub", &TfParser::ParseSub }, + { "Sub", &TfParser::ParseSub } +}; + +const std::list<std::string> TfParser::m_ControlInputs = { + "Assert" }; ITfParser* ITfParser::CreateRaw() @@ -544,14 +548,8 @@ TfParser::GetTfInputNodes(const tensorflow::NodeDef& nodeDef) const if (nodeDef.input(j)[0] == '^') // I couldn't find a better test for control inputs. { - throw ParseException( - boost::str( - boost::format( - "Node '%1%' has Control Input '%2%' for input #%3% which is unsupported. %4%") - % nodeDef.name() - % nodeDef.input(j) - % j - % CHECK_LOCATION().AsString())); + // We currently allow Control Input from TensorFlow graph but we ignore them from ArmNN graph. + continue; } auto inputIt = m_NodesByName.find(outputId.m_IndexedValue); @@ -2941,6 +2939,12 @@ void TfParser::LoadNodeDef(const tensorflow::NodeDef& nodeDef, const tensorflow: } const std::string& operation = nodeDef.op(); + auto itControlInput = std::find(m_ControlInputs.begin(), m_ControlInputs.end(), operation); + if (itControlInput != m_ControlInputs.end()) + { + // We currently allow Control Input from TensorFlow graph but we ignore them from ArmNN graph. + return; + } auto it = ms_OperationNameToParsingFunctions.find(operation); if (it != ms_OperationNameToParsingFunctions.end()) { |