From c975f9295e076febd4ecd45c9174d54f7327b3cc Mon Sep 17 00:00:00 2001 From: Aron Virginas-Tar Date: Wed, 23 Oct 2019 17:38:17 +0100 Subject: IVGCVSW-4007 Add StandInLayer for unsupported operations in TfLiteParser * Fixed bug in custom operator support that caused all custom operators to be parsed as a DetectionPostProcessLayer * Added support for handling unsupported operators (built-in or custom) by replacing them with a StandInLayer in the generated network * Added options to TfLiteParser to control whether we want to use StandInLayers when we encounter unsupported operators, or we prefer to throw a ParserException as until now Signed-off-by: Aron Virginas-Tar Change-Id: I125a63016c7c510b1fdde6033842db4f276718c4 --- .../test/ParserFlatbuffersFixture.hpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/armnnTfLiteParser/test/ParserFlatbuffersFixture.hpp') diff --git a/src/armnnTfLiteParser/test/ParserFlatbuffersFixture.hpp b/src/armnnTfLiteParser/test/ParserFlatbuffersFixture.hpp index b20bea247d..0c6428012b 100644 --- a/src/armnnTfLiteParser/test/ParserFlatbuffersFixture.hpp +++ b/src/armnnTfLiteParser/test/ParserFlatbuffersFixture.hpp @@ -29,22 +29,27 @@ #include using armnnTfLiteParser::ITfLiteParser; -using TensorRawPtr = const tflite::TensorT *; +using armnnTfLiteParser::ITfLiteParserPtr; +using TensorRawPtr = const tflite::TensorT *; struct ParserFlatbuffersFixture { ParserFlatbuffersFixture() : - m_Parser(ITfLiteParser::Create()), + m_Parser(nullptr, &ITfLiteParser::Destroy), m_Runtime(armnn::IRuntime::Create(armnn::IRuntime::CreationOptions())), m_NetworkIdentifier(-1) { + ITfLiteParser::TfLiteParserOptions options; + options.m_StandInLayerForUnsupported = true; + + m_Parser.reset(ITfLiteParser::CreateRaw(armnn::Optional(options))); } std::vector m_GraphBinary; - std::string m_JsonString; - std::unique_ptr m_Parser; - armnn::IRuntimePtr m_Runtime; - armnn::NetworkId m_NetworkIdentifier; + std::string m_JsonString; + ITfLiteParserPtr m_Parser; + armnn::IRuntimePtr m_Runtime; + armnn::NetworkId m_NetworkIdentifier; /// If the single-input-single-output overload of Setup() is called, these will store the input and output name /// so they don't need to be passed to the single-input-single-output overload of RunTest(). @@ -346,4 +351,4 @@ void ParserFlatbuffersFixture::RunTest(std::size_t subgraphId, } } } -} \ No newline at end of file +} -- cgit v1.2.1