From 4d217c02fe2c0a32ff9da69d8fe375a75173c0f3 Mon Sep 17 00:00:00 2001 From: Matthew Sloyan Date: Thu, 7 Oct 2021 11:48:58 +0100 Subject: IVGCVSW-6461 Building Arm NN failed after adding Conv3d to TFLiteparser * Add hash define to Conv3d for backwards compatibility when compiling with TF 2.3.1 Signed-off-by: Matthew Sloyan Change-Id: I70eec3b26430240852938af34b065b32bab91ebe --- src/armnnTfLiteParser/TfLiteParser.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/armnnTfLiteParser/TfLiteParser.cpp') diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp index 104a55e675..81d491a1a1 100644 --- a/src/armnnTfLiteParser/TfLiteParser.cpp +++ b/src/armnnTfLiteParser/TfLiteParser.cpp @@ -32,8 +32,6 @@ #include -#include - #include #include #include @@ -642,7 +640,10 @@ TfLiteParserImpl::TfLiteParserImpl(const Optionaloperator_codes[op->opcode_index]; // work around the introduction of the deprecated_builtin_code introduced in 2.4 in a backwards compatible manner -#if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 3) +#if defined(ARMNN_POST_TFLITE_2_3) auto builtinCode = std::max(opCodePtr->builtin_code, static_cast(opCodePtr->deprecated_builtin_code)); #else @@ -899,7 +900,7 @@ void TfLiteParserImpl::ParseUnsupportedOperator(size_t subgraphIndex, size_t ope auto opcodeIndex = operatorPtr->opcode_index; // work around the introduction of the deprecated_builtin_code introduced in 2.4 in a backwards compatible manner -#if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 3) +#if defined(ARMNN_POST_TFLITE_2_3) auto opcode = std::max(m_Model->operator_codes[opcodeIndex]->builtin_code, static_cast(m_Model->operator_codes[opcodeIndex]->deprecated_builtin_code)); #else @@ -1049,6 +1050,8 @@ void TfLiteParserImpl::ParseConv2D(size_t subgraphIndex, size_t operatorIndex) RegisterOutputSlots(subgraphIndex, operatorIndex, layer, {outputTensorIndexes[0]}); } +// Conv3D support was added in TF 2.5, so for backwards compatibility a hash define is needed. +#if defined(ARMNN_POST_TFLITE_2_3) void TfLiteParserImpl::ParseConv3D(size_t subgraphIndex, size_t operatorIndex) { CHECK_MODEL(m_Model, subgraphIndex, operatorIndex); @@ -1132,6 +1135,7 @@ void TfLiteParserImpl::ParseConv3D(size_t subgraphIndex, size_t operatorIndex) auto outputTensorIndexes = AsUnsignedVector(GetOutputTensorIds(m_Model, subgraphIndex, operatorIndex)); RegisterOutputSlots(subgraphIndex, operatorIndex, layer, {outputTensorIndexes[0]}); } +#endif void TfLiteParserImpl::ParseDepthwiseConv2D(size_t subgraphIndex, size_t operatorIndex) { -- cgit v1.2.1