option(BUILD_GTEST "Download and build Google Test" ON)
nnfw_find_package(GTest QUIET)
-# NOTE Workaround to avoid build fail by tensorflow (or acl) package version mismatch on obs build
-if(OBS_BUILD)
- add_definitions(-DOBS_BUILD)
-endif(OBS_BUILD)
+# NOTE For now NNFW supports two TFLITE versions - v1.12 for Unbuntu and v1.9 for Tizen.
+# So TFLITE version should mandatorily be specified to distinguish the version.
+if(NOT TFLITE_MAJOR_VER OR NOT TFLITE_MINOR_VER)
+ message(FATAL_ERROR "TFLITE_MAJOR_VER and TFLITE_MINOR_VER should be defined")
+endif(NOT TFLITE_MAJOR_VER OR NOT TFLITE_MINOR_VER)
+
+add_definitions(-DTFLITE_MAJOR_VER=${TFLITE_MAJOR_VER} -DTFLITE_MINOR_VER=${TFLITE_MINOR_VER})
nnfw_include(ExtendCMakeFunction)
BENCHMARK_ACL_BUILD?=0
OPTIONS?=
GENERATE_NNAPI_TESTS?=1
+TFLITE_MAJOR_VER?=1
+TFLITE_MINOR_VER?=12
# make TARGET and TYPE to lowercase
TARGET_ARCH_LC=$(shell echo $(TARGET_ARCH) | tr A-Z a-z)
-DHOST_OS=$(HOST_OS) \
-DTARGET_OS=$(TARGET_OS) \
-DOBS_BUILD=$(OBS_BUILD) \
+ -DTFLITE_MAJOR_VER=$(TFLITE_MAJOR_VER) \
+ -DTFLITE_MINOR_VER=$(TFLITE_MINOR_VER) \
$(OPTION_TOOLCHAIN) \
$(OPTIONS)
touch $(TIMESTAMP_CONFIGURE)
#define __NNFW_TFLITE_EXT_NNAPI_DELEGATE_H__
#include "tensorflow/contrib/lite/allocation.h"
-#ifdef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 9
#include "tensorflow/contrib/lite/context.h"
#include "tensorflow/contrib/lite/error_reporter.h"
#else
TfLiteRegistration *Register_SIN();
TfLiteRegistration *Register_TRANSPOSE_CONV();
TfLiteRegistration *Register_SPARSE_TO_DENSE();
-#ifndef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
TfLiteRegistration *Register_SUM();
TfLiteRegistration *Register_REDUCE_MAX();
TfLiteRegistration *Register_REDUCE_MIN();
TfLiteRegistration *Register_FLOOR_DIV();
TfLiteRegistration *Register_SQUARE();
TfLiteRegistration *Register_ZEROS_LIKE();
-#endif // OBS_BUILD
+#endif // TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
} // namespace builtin
} // namespace ops
AddBuiltin(BuiltinOperator_SELECT, Register_SELECT());
AddBuiltin(BuiltinOperator_SLICE, Register_SLICE());
AddBuiltin(BuiltinOperator_SIN, Register_SIN());
-#ifndef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
AddBuiltin(BuiltinOperator_SUM, Register_SUM());
AddBuiltin(BuiltinOperator_REDUCE_MAX, Register_REDUCE_MAX());
AddBuiltin(BuiltinOperator_REDUCE_MIN, Register_REDUCE_MIN());
AddBuiltin(BuiltinOperator_FLOOR_DIV, Register_FLOOR_DIV());
AddBuiltin(BuiltinOperator_SQUARE, Register_SQUARE());
AddBuiltin(BuiltinOperator_ZEROS_LIKE, Register_ZEROS_LIKE());
-#endif // OBS_BUILD
+#endif // TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
AddCustom("TensorFlowMax", nnfw::tflite::custom::Register_TensorFlowMax());
AddCustom("SquaredDifference", nnfw::tflite::custom::Register_SquaredDifference());
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
-#ifdef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 9
#include "tensorflow/contrib/lite/builtin_op_data.h"
#include "tensorflow/contrib/lite/error_reporter.h"
#else
};
auto add_mean_params = [&add_scalar_int32](void* data) {
-#ifdef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 9
auto builtin = reinterpret_cast<TfLiteMeanParams*>(data);
#else
auto builtin = reinterpret_cast<TfLiteReducerParams*>(data);
augmented_inputs.data(), static_cast<uint32_t>(node.outputs->size),
reinterpret_cast<uint32_t*>(node.outputs->data)));
continue;
-#ifndef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
case tflite::BuiltinOperator_PACK:
add_pack_ex_params(node.builtin_data);
CHECK_NN(ANeuralNetworksModel_addOperationEx(
//case tflite::BuiltinOperator_PRELU:
case tflite::BuiltinOperator_MAXIMUM:
case tflite::BuiltinOperator_MINIMUM:
-#ifndef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
case tflite::BuiltinOperator_ARG_MIN:
#endif
case tflite::BuiltinOperator_GREATER:
case tflite::BuiltinOperator_SELECT:
case tflite::BuiltinOperator_SLICE:
case tflite::BuiltinOperator_SIN:
-#ifndef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
case tflite::BuiltinOperator_LOG:
#endif
//case tflite::BuiltinOperator_TRANSPOSE_CONV:
-#ifndef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
case tflite::BuiltinOperator_TILE:
case tflite::BuiltinOperator_EXPAND_DIMS:
case tflite::BuiltinOperator_SPARSE_TO_DENSE:
return kTfLiteError;
break;
}
-#ifdef OBS_BUILD
default:
logError("Op code %d is currently not delegated to NNAPI", builtin);
return kTfLiteError;
break;
-#endif
}
if (nnapi_version == 11 && GetAndroidSdkVersionCached() < 28) {
}
};
-#ifndef OBS_BUILD
+#if TFLITE_MAJOR_VER == 1 && TFLITE_MINOR_VER == 12
auto add_pack_ex_params = [&add_scalar_int32](void* data) {
auto builtin = reinterpret_cast<TfLitePackParams*>(data);
add_scalar_int32(builtin->values_count);
%{!?coverage_build: %define coverage_build 0}
%if %{coverage_build} == 1
-%define build_options COVERAGE_BUILD=1 OBS_BUILD=1 BUILD_TYPE=Debug TARGET_ARCH=%{target_arch} TARGET_OS=tizen
+%define build_options COVERAGE_BUILD=1 OBS_BUILD=1 BUILD_TYPE=Debug TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=9
%else
-%define build_options OBS_BUILD=1 BUILD_TYPE=%{build_type} INSTALL_PATH=%{buildroot}%{_prefix} TARGET_ARCH=%{target_arch} TARGET_OS=tizen
+%define build_options OBS_BUILD=1 BUILD_TYPE=%{build_type} INSTALL_PATH=%{buildroot}%{_prefix} TARGET_ARCH=%{target_arch} TARGET_OS=tizen TFLITE_MAJOR_VER=1 TFLITE_MINOR_VER=9
%endif
%prep