summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>2018-12-05 15:24:07 +0900
committerGitHub Enterprise <noreply-CODE@samsung.com>2018-12-05 15:24:07 +0900
commit98186204b29c58953fec9dc66711f296e180c7cc (patch)
tree9784b31d2b70d351bd1cb622d47fa984c33d4419 /include
parentf2a3dc9e85262d6c9dbc616f03ac8dc2c65f961f (diff)
downloadnnfw-98186204b29c58953fec9dc66711f296e180c7cc.tar.gz
nnfw-98186204b29c58953fec9dc66711f296e180c7cc.tar.bz2
nnfw-98186204b29c58953fec9dc66711f296e180c7cc.zip
Move include/support (#3876)
Move include/support to libs/support/include/support Update cmake for include Add .FORMATDENY to avoid format checking Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/support/nnapi/Utils.h46
-rw-r--r--include/support/nnapi/feature/Reader.h80
-rw-r--r--include/support/nnapi/feature/Utils.h54
-rw-r--r--include/support/tflite/Assert.h44
-rw-r--r--include/support/tflite/Diff.h204
-rw-r--r--include/support/tflite/FeatureView.h109
-rw-r--r--include/support/tflite/InputIndex.h63
-rw-r--r--include/support/tflite/InterpreterSession.h102
-rw-r--r--include/support/tflite/NNAPISession.h107
-rw-r--r--include/support/tflite/OutputIndex.h63
-rw-r--r--include/support/tflite/Quantization.h44
-rw-r--r--include/support/tflite/Session.h72
-rw-r--r--include/support/tflite/TensorLogger.h172
-rw-r--r--include/support/tflite/TensorShapeUtils.h67
-rw-r--r--include/support/tflite/TensorUtils.h59
-rw-r--r--include/support/tflite/TensorView.h124
-rw-r--r--include/support/tflite/interp/Builder.h59
-rw-r--r--include/support/tflite/interp/FlatBufferBuilder.h70
-rw-r--r--include/support/tflite/interp/FunctionBuilder.h73
-rw-r--r--include/support/tflite/kernels/Abs.h44
-rw-r--r--include/support/tflite/kernels/CustomOps.h62
-rw-r--r--include/support/tflite/kernels/SquaredDifference.h78
-rw-r--r--include/support/tflite/kernels/TensorFlowMax.h78
-rw-r--r--include/support/tflite/kernels/TensorFlowSum.h44
-rw-r--r--include/support/tflite/kernels/register.h40
-rw-r--r--include/support/tflite/nnapi_delegate.h95
26 files changed, 0 insertions, 2053 deletions
diff --git a/include/support/nnapi/Utils.h b/include/support/nnapi/Utils.h
deleted file mode 100644
index 78a0e75ea..000000000
--- a/include/support/nnapi/Utils.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Utils.h
- * @brief This file contains utility functions
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_NNAPI_UTILS_H__
-#define __NNFW_SUPPORT_NNAPI_UTILS_H__
-
-#include "NeuralNetworks.h"
-
-namespace nnfw
-{
-namespace support
-{
-namespace nnapi
-{
-
-/**
- * @brief Converts a PaddingCode to const char*
- * @param[in] code The PaddingCode to be converted
- * @return A string holding the converted value
- */
-const char *to_string(const PaddingCode &code);
-
-} // namespace nnapi
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_NNAPI_UTILS_H__
diff --git a/include/support/nnapi/feature/Reader.h b/include/support/nnapi/feature/Reader.h
deleted file mode 100644
index 3ad9b1700..000000000
--- a/include/support/nnapi/feature/Reader.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Reader.h
- * @brief This file contains Reader class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_NNAPI_FEATURE_READER_H__
-#define __NNFW_SUPPORT_NNAPI_FEATURE_READER_H__
-
-#include "support/nnapi/feature/Utils.h"
-
-#include "util/feature/Shape.h"
-#include "util/feature/Reader.h"
-
-namespace nnfw
-{
-namespace support
-{
-namespace nnapi
-{
-namespace feature
-{
-
-/**
- * @brief Class to read value of feature which is inherited from nnfw::util::feature::Reader<T> class
- */
-template<typename T> class Reader : public nnfw::util::feature::Reader<T>
-{
-public:
- /**
- * @brief Construct a new Reader object with base and shape informations
- * @param[in] shape The shape of a feature
- * @param[in] base The base address of a feature
- */
- Reader(const nnfw::util::feature::Shape &shape, const T *base)
- : _shape{shape}, _base{base}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get the value used by three indexes
- * @param[in] ch The channel index
- * @param[in] row The row index
- * @param[in] col The column index
- * @return The value at the offset
- */
- T at(uint32_t ch, uint32_t row, uint32_t col) const override
- {
- return *(_base + indexOf(_shape, ch, row, col));
- }
-
-private:
- nnfw::util::feature::Shape _shape; /**< Shape of feature */
- const T *_base; /**< Base address of feature */
-};
-
-} // namespace feature
-} // namespace nnapi
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_NNAPI_FEATURE_READER_H__
diff --git a/include/support/nnapi/feature/Utils.h b/include/support/nnapi/feature/Utils.h
deleted file mode 100644
index eac508331..000000000
--- a/include/support/nnapi/feature/Utils.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Utils.h
- * @brief This file contains indexOf function
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_NNAPI_FEATURE_UTILS_H__
-#define __NNFW_SUPPORT_NNAPI_FEATURE_UTILS_H__
-
-#include "util/feature/Shape.h"
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace support
-{
-namespace nnapi
-{
-namespace feature
-{
-
-/**
- * @brief Get index for given parameters
- * @param[in] shape The shape of feature
- * @param[in] ch The channel index
- * @param[in] row The row index
- * @param[in] col The column index
- * @return The value index of given parameters
- */
-uint32_t indexOf(const nnfw::util::feature::Shape &shape, uint32_t ch, uint32_t row, uint32_t col);
-
-} // namespace feature
-} // namespace nnapi
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_NNAPI_FEATURE_UTILS_H__
diff --git a/include/support/tflite/Assert.h b/include/support/tflite/Assert.h
deleted file mode 100644
index 77da5e6c6..000000000
--- a/include/support/tflite/Assert.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Assert.h
- * @brief This file contains helper function of assertion
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_ASSERT_H__
-#define __NNFW_SUPPORT_TFLITE_ASSERT_H__
-
-#include "tensorflow/contrib/lite/context.h"
-
-#include <sstream>
-
-#define STR_DETAIL(value) #value
-#define STR(value) STR_DETAIL(value)
-
-#define TFLITE_ENSURE(exp) { \
- const TfLiteStatus status = (exp); \
- \
- if (status != kTfLiteOk) \
- { \
- std::ostringstream ss; \
- ss << #exp << " failed (" << __FILE__ << ":" << __LINE__ << ")"; \
- throw std::runtime_error{ss.str()}; \
- } \
-}
-
-#endif // __NNFW_SUPPORT_TFLITE_ASSERT_H__
diff --git a/include/support/tflite/Diff.h b/include/support/tflite/Diff.h
deleted file mode 100644
index 6a43a575d..000000000
--- a/include/support/tflite/Diff.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Diff.h
- * @brief This file contains classes for testing correctess of implementation
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_COMPARE_H__
-#define __NNFW_SUPPORT_TFLITE_COMPARE_H__
-
-#include "tensorflow/contrib/lite/interpreter.h"
-
-#include "util/tensor/Index.h"
-#include "util/tensor/Diff.h"
-#include "util/tensor/Shape.h"
-#include "util/tensor/Comparator.h"
-
-#include "support/tflite/TensorView.h"
-
-#include <functional>
-#include <vector>
-
-/**
- * @brief Class to define TfLite interpreter match application
- */
-class TfLiteInterpMatchApp
-{
-public:
- /**
- * @brief Construct a new TfLiteInterpMatchApp object with Comparator
- * @param[in] comparator Comparator object for tensor comparation
- */
- TfLiteInterpMatchApp(const nnfw::util::tensor::Comparator &comparator)
- : _verbose{false}, _comparator(comparator)
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get reference verbose for debugging information
- * @return Reference of verbose value
- */
- int &verbose(void) { return _verbose; }
-
-private:
- int _verbose;
-
-public:
- /**
- * @brief Run two interpreter and return the output matching
- * @param[in] pure Interpreter object of expected(with TfLite)
- * @param[in] nnapi Interpreter object of obtained(through NNAPI)
- * @return @c true if two Interpreter results are same, otherwise @c false
- */
- bool run(::tflite::Interpreter &pure, ::tflite::Interpreter &nnapi) const;
- /**
- * @brief Compare two TensorView values and return the match result
- * @param[in] expected TensorView object to read expected values
- * @param[in] obtained TensorView object to read obtained values
- * @param[in] id Tensor ID value used for debug message
- * @return @c true if two TensorView values are same, otherwise @c false
- */
- template <typename T>
- bool compareSingleTensorView(const nnfw::support::tflite::TensorView<T> &expected,
- const nnfw::support::tflite::TensorView<T> &obtained,
- int id) const;
-
-private:
- const nnfw::util::tensor::Comparator &_comparator;
-};
-
-#include "support/tflite/interp/Builder.h"
-#include "support/tflite/Quantization.h"
-
-#include <random>
-
-/**
- * @brief Class to generate random values
- */
-class RandomGenerator
-{
-public:
- /**
- * @brief Construct a new RandomGenerator object
- * @param[in] seed Random seed value
- * @param[in] mean Mean value of normal random number generation
- * @param[in] stddev Standard deviation of random number generation
- * @param[in] quantization TfLiteQuantizationParams type to represent quantization value
- * (not used yet)
- */
- RandomGenerator(int seed, float mean, float stddev,
- const TfLiteQuantizationParams quantization = make_default_quantization())
- : _rand{seed}, _dist{mean, stddev}, _quantization{quantization}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Generate random numbers for type T
- * @param[in] s Shape value
- * @param[in] i Index value
- * @return Random generated value
- * @note This is same as T generate(void) as two input parameters are not used
- */
- template <typename T>
- T generate(const ::nnfw::util::tensor::Shape &, const ::nnfw::util::tensor::Index &)
- {
- return generate<T>();
- }
-
- /**
- * @brief Generate random numbers for type T
- * @return Random generated value
- */
- template <typename T> T generate(void)
- {
- return _dist(_rand);
- }
-
-private:
- std::minstd_rand _rand;
- std::normal_distribution<float> _dist;
- const TfLiteQuantizationParams _quantization;
-};
-
-template <>
-uint8_t RandomGenerator::generate<uint8_t>(void);
-
-/**
- * @brief Structure for NNAPI correctness test
- */
-struct RandomTestParam
-{
- int verbose; //!< Verbosity of debug information
- int tolerance; //!< Torlerance of value difference
- int tensor_logging = 0; //!< Save logging to a file if not 0
- std::string log_path = ""; //!< Path of log file, meaningful only when tensor_logging is 1
-};
-
-/**
- * @brief Class to define Random test runner
- */
-class RandomTestRunner
-{
-public:
- /**
- * @brief Construct a new RandomTestRunner object
- * @param[in] seed Random seed value
- * @param[in] param RandomTestParam object for test runner
- * @param[in] quantization TfLiteQuantizationParams type to represent quantization value
- */
- RandomTestRunner(int seed, const RandomTestParam &param,
- const TfLiteQuantizationParams quantization = make_default_quantization())
- : _randgen{seed, 0.0f, 2.0f, quantization}, _param{param}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Run the random test runner
- * @param[in] builder Interpreter Builder used to run
- * @return 0 if test succeeds, otherwise failure
- */
- int run(const nnfw::support::tflite::interp::Builder &builder);
-
-public:
- /**
- * @brief Get RandomGenerator reference
- * @return RandomGenerator reference
- */
- RandomGenerator &generator() { return _randgen; };
-
-private:
- RandomGenerator _randgen;
- const RandomTestParam _param;
-
-public:
- /**
- * @brief Create a RandomTestRunner object
- * @param[in] seed Random seed value
- * @return RandomGenerator object
- */
- static RandomTestRunner make(int seed);
-};
-
-#endif // __NNFW_SUPPORT_TFLITE_COMPARE_H__
diff --git a/include/support/tflite/FeatureView.h b/include/support/tflite/FeatureView.h
deleted file mode 100644
index 7f260ed66..000000000
--- a/include/support/tflite/FeatureView.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file FeatureView.h
- * @brief This file contains FeatureView class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_FEATURE_VIEW_H__
-#define __NNFW_SUPPORT_TFLITE_FEATURE_VIEW_H__
-
-#include "tensorflow/contrib/lite/interpreter.h"
-
-#include "support/tflite/InputIndex.h"
-#include "support/tflite/OutputIndex.h"
-
-#include "util/feature/Shape.h"
-#include "util/feature/Reader.h"
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-template<typename T> class FeatureView;
-
-/**
- * @brief Class to support reading element of float type feature
- */
-template<> class FeatureView<float> : public nnfw::util::feature::Reader<float>
-{
-public:
- /**
- * @brief Construct a new FeatureView object
- * @param[in] interp Interpreter to read from
- * @param[in] index InputIndex index of input
- */
- FeatureView(::tflite::Interpreter &interp, const InputIndex &index);
- /**
- * @brief Construct a new FeatureView object
- * @param[in] interp Interpreter to read from
- * @param[in] index OutputIndex index of output
- */
- FeatureView(::tflite::Interpreter &interp, const OutputIndex &index);
-
-public:
- /**
- * @brief Get value of element using channel, row and column index
- * @param[in] ch Channel index
- * @param[in] row Row index
- * @param[in] col Column index
- * @return Value of element
- */
- float at(uint32_t ch, uint32_t row, uint32_t col) const;
- /**
- * @brief Get reference of element using channel, row and column index
- * @param[in] ch Channel index
- * @param[in] row Row index
- * @param[in] col Column index
- * @return Reference of element
- */
- float &at(uint32_t ch, uint32_t row, uint32_t col);
-
-private:
- /**
- * @brief Get offset of element from channel, row and column index
- * @param[in] ch Channel index
- * @param[in] row Row index
- * @param[in] col Column index
- * @return Offset of element
- */
- uint32_t getElementOffset(uint32_t ch, uint32_t row, uint32_t col) const
- {
- uint32_t res = 0;
-
- // TensorFlow Lite assumes that NHWC ordering for tessor
- res += row * _shape.W * _shape.C;
- res += col * _shape.C;
- res += ch;
-
- return res;
- }
-
-private:
- nnfw::util::feature::Shape _shape;
- float *_base;
-};
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_FEATURE_VIEW_H__
diff --git a/include/support/tflite/InputIndex.h b/include/support/tflite/InputIndex.h
deleted file mode 100644
index 3c668858f..000000000
--- a/include/support/tflite/InputIndex.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file InputIndex.h
- * @brief This file contains InputIndex class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_INPUT_INDEX_H__
-#define __NNFW_SUPPORT_TFLITE_INPUT_INDEX_H__
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Class to express index of input
- */
-class InputIndex
-{
-public:
- /**
- * @brief Construct a new InputIndex object with index value
- * @param [in] index The value of index
- */
- InputIndex(int index) : _index(index)
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get index value as int
- * @return Index value as int
- */
- int asInt(void) const { return _index; }
-
-private:
- int _index;
-};
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_INPUT_INDEX_H__
diff --git a/include/support/tflite/InterpreterSession.h b/include/support/tflite/InterpreterSession.h
deleted file mode 100644
index 63c2a12c2..000000000
--- a/include/support/tflite/InterpreterSession.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file InterpreterSession.h
- * @brief This file contains InterpreterSession class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_INTERPRETER_SESSION_H__
-#define __NNFW_SUPPORT_TFLITE_INTERPRETER_SESSION_H__
-
-#include "Session.h"
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Class to define TfLite interpreter session which is inherited from Session class
- */
-class InterpreterSession final : public Session
-{
-public:
- /**
- * @brief Construct a InterpreterSession object with interpreter of TfLite
- * @param[in] interp The TfLite interpreter pointer
- */
- InterpreterSession(::tflite::Interpreter *interp) : _interp{interp}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get TfLite interpreter pointer
- * @return The TfLite interpreter
- */
- ::tflite::Interpreter *interp(void) override { return _interp; }
-
-public:
- /**
- * @brief Prepare the TfLite interpreter session
- * @return @c true if tensor preparation is successful, otherwise @c false
- */
- bool prepare(void) override
- {
- _interp->UseNNAPI(false);
-
- if (kTfLiteOk != _interp->AllocateTensors())
- {
- return false;
- }
-
- return true;
- }
-
- /**
- * @brief Run the Invoke function of TfLite interpreter
- * @return @c true if Invoke() is successful, otherwise @c false
- */
- bool run(void) override
- {
- // Return true if Invoke returns kTfLiteOk
- return kTfLiteOk == _interp->Invoke();
- }
-
- /**
- * @brief Tear down TfLite interpreter session
- * @return @c true always
- */
- bool teardown(void) override
- {
- // Do NOTHING currently
- return true;
- }
-
-private:
- ::tflite::Interpreter * const _interp;
-};
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_INTERPRETER_SESSION_H__
diff --git a/include/support/tflite/NNAPISession.h b/include/support/tflite/NNAPISession.h
deleted file mode 100644
index 704662276..000000000
--- a/include/support/tflite/NNAPISession.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file NNAPISession.h
- * @brief This file contains NNAPISession class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_NNAPI_SESSION_H__
-#define __NNFW_SUPPORT_TFLITE_NNAPI_SESSION_H__
-
-#include "Session.h"
-#include "support/tflite/nnapi_delegate.h"
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Class to define NNAPI interpreter session which is inherited from Session class
- */
-class NNAPISession final : public Session
-{
-public:
- /**
- * @brief Construct a NNAPISession object with interpreter of TfLite
- * @param[in] interp The TfLite interpreter pointer
- * @note Invoke BuildGraph() of NNAPI delegate from Interpreter
- */
- NNAPISession(::tflite::Interpreter *interp) : _interp{interp}
- {
- // Construct Graph from Interpreter
- _delegate.BuildGraph(_interp);
- }
-
-public:
- /**
- * @brief Get TfLite interpreter pointer
- * @return The TfLite interpreter
- */
- ::tflite::Interpreter *interp(void) override { return _interp; }
-
-public:
- /**
- * @brief Prepare the TfLite interpreter session
- * @return @c true if tensor preparation is successful, otherwise @c false
- */
- bool prepare(void) override
- {
- // Explicitly turn off T/F lite internal NNAPI delegation in order to use locally defined
- // NNAPI delegation.
- _interp->UseNNAPI(false);
-
- if (kTfLiteOk != _interp->AllocateTensors())
- {
- return false;
- }
-
- return true;
- }
-
- /**
- * @brief Run the Invoke function of NNAPI delegate
- * @return @c true if Invoke() is successful, otherwise @c false
- */
- bool run(void) override
- {
- return kTfLiteOk == _delegate.Invoke(_interp);
- }
-
- /**
- * @brief Tear down TfLite interpreter session
- * @return @c true always
- */
- bool teardown(void) override
- {
- // DO NOTHING
- return true;
- }
-
-private:
- ::tflite::Interpreter * const _interp;
- nnfw::NNAPIDelegate _delegate;
-};
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_NNAPI_SESSION_H__
diff --git a/include/support/tflite/OutputIndex.h b/include/support/tflite/OutputIndex.h
deleted file mode 100644
index d43841693..000000000
--- a/include/support/tflite/OutputIndex.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file OutputIndex.h
- * @brief This file contains OutputIndex class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_OUTPUT_INDEX_H__
-#define __NNFW_SUPPORT_TFLITE_OUTPUT_INDEX_H__
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Class to define OutputIndex
- */
-class OutputIndex
-{
-public:
- /**
- * @brief Construct a OutputIndex object with index value
- * @param[in] index The value of index
- */
- OutputIndex(int index) : _index(index)
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get index value as int
- * @return Index valuel as int
- */
- int asInt(void) const { return _index; }
-
-private:
- int _index;
-};
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_OUTPUT_INDEX_H__
diff --git a/include/support/tflite/Quantization.h b/include/support/tflite/Quantization.h
deleted file mode 100644
index fb1b675b9..000000000
--- a/include/support/tflite/Quantization.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Quantization.h
- * @brief This file contains BitwiseIntToFloat union and quantization related
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_QUANTIZATION_H__
-#define __NNFW_SUPPORT_TFLITE_QUANTIZATION_H__
-
-/**
- * @brief Union to provide bitwise conversion of integer and float
- */
-union BitwiseIntToFloat {
- int i;
- float f;
-};
-
-static const float FLOAT_NEAREST_TO_1 = BitwiseIntToFloat{0x3f7fffff}.f;
-
-#include "tensorflow/contrib/lite/context.h"
-
-/**
- * @brief Get TfLiteQuantizationParams object with default values
- * @return TfLiteQuantizationParams object
- */
-TfLiteQuantizationParams make_default_quantization(void);
-
-#endif // __NNFW_SUPPORT_TFLITE_QUANTIZATION_H__
diff --git a/include/support/tflite/Session.h b/include/support/tflite/Session.h
deleted file mode 100644
index 038520889..000000000
--- a/include/support/tflite/Session.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Session.h
- * @brief This file contains Session class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_SESSION_H__
-#define __NNFW_SUPPORT_TFLITE_SESSION_H__
-
-#include <tensorflow/contrib/lite/interpreter.h>
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Structure to provide interface methods of interpreter session
- */
-struct Session
-{
- /**
- * @brief Destruct Session object using default destructor
- */
- virtual ~Session() = default;
-
- /**
- * @brief Get the Interpreter object pointer
- * @return The Interpreter object pointer
- */
- virtual ::tflite::Interpreter *interp(void) = 0;
-
- /**
- * @brief Prepare the session
- * @return @c true if prepare method succeeded, otherwise @c false
- */
- virtual bool prepare(void) = 0;
- /**
- * @brief Run the session
- * @return @c true if run method succeeded, otherwise @c false
- */
- virtual bool run(void) = 0;
- /**
- * @brief Teardown(release) the session
- * @return @c true if teardown method succeeded, otherwise @c false
- */
- virtual bool teardown(void) = 0;
-};
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_INTERP_SESSION_H__
diff --git a/include/support/tflite/TensorLogger.h b/include/support/tflite/TensorLogger.h
deleted file mode 100644
index f10f32af1..000000000
--- a/include/support/tflite/TensorLogger.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file TensorLogger.h
- * @brief This file contains TensorLogger class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_TENSOR_LOGGER_H__
-#define __NNFW_SUPPORT_TFLITE_TENSOR_LOGGER_H__
-
-#include "util/tensor/IndexIterator.h"
-#include "support/tflite/TensorView.h"
-
-#include <tensorflow/contrib/lite/interpreter.h>
-#include <tensorflow/contrib/lite/context.h>
-#include <fstream>
-#include <iomanip>
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Class to write input and output value / shape into a file in python form
- * @note This is a utility to write input and output value / shape into a file in python form.\n
- * any python app can load this value by running the python code below:\n
- * exec(open(filename).read())\n
- * generated python code looks like the following: \n
- * tensor_shape_gen = []\n
- * tensor_value_gen = []\n\n
- * tensor_shape_gen.append("{2, 1, 2}")\n
- * tensor_value_gen.append([1, 2, 3, 4])\n\n
- * tensor_shape_gen.append("{2}")\n
- * tensor_value_gen.append([1, 2])\n\n
- * tensor_shape_gen.append("{2, 1, 2}")\n
- * tensor_value_gen.append([1, 4, 3, 8])\n
- */
-class TensorLogger
-{
- private:
- std::ofstream _outfile;
-
- public:
- /**
- * @brief Get TensorLogger instance
- * @return The TensorLogger instance
- */
- static TensorLogger &instance()
- {
- static TensorLogger instance;
- return instance;
- }
-
- /**
- * @brief Save the tensor details to file from interpreter
- * @param[in] path The file path to save
- * @param[in] interp The TfLite interpreter
- */
- void save(const std::string &path, ::tflite::Interpreter &interp)
- {
- open(path);
-
- int log_index = 0;
- for (const auto id : interp.inputs())
- {
- _outfile << "# input tensors" << std::endl;
- printTensor(interp, id, log_index++);
- }
- for (const auto id : interp.outputs())
- {
- _outfile << "# output tensors" << std::endl;
- printTensor(interp, id, log_index++);
- }
- close();
- }
-
- private:
-
- void open(const std::string &path)
- {
- if (! _outfile.is_open())
- _outfile.open(path, std::ios_base::out);
-
- _outfile << "# ------ file: " << path << " ------" << std::endl
- << "tensor_shape_gen = []" << std::endl
- << "tensor_value_gen = []" << std::endl << std::endl;
- }
-
- void printTensor(::tflite::Interpreter &interp, const int id, const int log_index)
- {
- const TfLiteTensor* tensor = interp.tensor(id);
-
- _outfile << "# tensor name: " << tensor->name << std::endl;
- _outfile << "# tflite::interpreter.tensor("<< id <<") -> "
- "tensor_value_gen["<< log_index << "]" << std::endl;
-
- if (tensor->type == kTfLiteInt32)
- {
- printTensorShape(tensor);
- printTensorValue<int32_t>(tensor, tensor->data.i32);
- }
- else if (interp.tensor(id)->type == kTfLiteUInt8)
- {
- printTensorShape(tensor);
- printTensorValue<uint8_t>(tensor, tensor->data.uint8);
- }
- else if (tensor->type == kTfLiteFloat32)
- {
- printTensorShape(tensor);
- printTensorValue<float>(tensor, tensor->data.f);
- }
- }
-
- void printTensorShape(const TfLiteTensor* tensor)
- {
- _outfile << "tensor_shape_gen.append('{";
-
- size_t r = 0;
- for (; r < tensor->dims->size - 1; r++)
- {
- _outfile << tensor->dims->data[r]
- << ", ";
- }
- _outfile << tensor->dims->data[r];
-
- _outfile << "}')" << std::endl;
- }
-
- template <typename T>
- void printTensorValue(const TfLiteTensor* tensor, T* tensor_data_ptr)
- {
- _outfile << "tensor_value_gen.append([";
-
- _outfile << std::fixed << std::setprecision(10);
-
- const T *end = reinterpret_cast<const T *>(tensor->data.raw_const + tensor->bytes);
- for (T *ptr = tensor_data_ptr; ptr < end; ptr++)
- _outfile << *ptr << ", ";
-
- _outfile << "])" << std::endl << std::endl;
- }
-
- void close()
- {
- _outfile << "# --------- tensor shape and value defined above ---------" << std::endl;
- _outfile.close();
- }
-};
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_TENSOR_LOGGER_H__
diff --git a/include/support/tflite/TensorShapeUtils.h b/include/support/tflite/TensorShapeUtils.h
deleted file mode 100644
index 99b90e9a8..000000000
--- a/include/support/tflite/TensorShapeUtils.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file TensorShapeUtils.h
- * @brief This file contains utilities function of tensor shape
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_TENSOR_SHAPE_UTILS_H__
-#define __NNFW_SUPPORT_TFLITE_TENSOR_SHAPE_UTILS_H__
-
-#include "util/tensor/Shape.h"
-
-#include <vector>
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Converts tensor::Shape into a vector
- * @param[in] shape The tensor shape to be converted
- * @return vector value of given shape object
- */
-static inline std::vector<int32_t> as_dims(const nnfw::util::tensor::Shape &shape)
-{
- std::vector<int32_t> dims;
-
- for (uint32_t axis = 0; axis < shape.rank(); ++axis)
- {
- dims.emplace_back(shape.dim(axis));
- }
-
- return dims;
-}
-
-/**
- * @brief Broadcasts between two given shapes
- * @param[in] lhs_shape The left hand side shape
- * @param[in] rhs_shape The right hand side shape
- * @return The broadcasted shape
- */
-nnfw::util::tensor::Shape broadcast(const nnfw::util::tensor::Shape &lhs_shape,
- const nnfw::util::tensor::Shape &rhs_shape);
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_TENSOR_SHAPE_UTILS_H__
diff --git a/include/support/tflite/TensorUtils.h b/include/support/tflite/TensorUtils.h
deleted file mode 100644
index 86cbccef2..000000000
--- a/include/support/tflite/TensorUtils.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file TensorUtils.h
- * @brief This file contains utilities function
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_TENSOR_UTILS_H__
-#define __NNFW_SUPPORT_TFLITE_TENSOR_UTILS_H__
-
-#include <tensorflow/contrib/lite/context.h>
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Get @c true if tensor type is kTfLiteFloat32, otherwise @c false
- * @param[in] tensor The tensor object to be compared
- * @return @c true if tensor type is kTfLiteFloat32, otherwise @c false
- */
-inline bool isFloatTensor(const TfLiteTensor *tensor)
-{
- return tensor->type == kTfLiteFloat32;
-}
-
-/**
- * @brief Get @c true if tensor is 4-D tensor and the first dimension length is 1, otherwise @c false
- * @param[in] tensor The tensor object to be compared
- * @return @c true if tensor is 4-D tensor and the first dimension length is 1, otherwise @c false
- */
-inline bool isFeatureTensor(const TfLiteTensor *tensor)
-{
- return (tensor->dims->size == 4) && (tensor->dims->data[0] == 1);
-}
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_TENSOR_UTILS_H__
diff --git a/include/support/tflite/TensorView.h b/include/support/tflite/TensorView.h
deleted file mode 100644
index d5573a280..000000000
--- a/include/support/tflite/TensorView.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file TensorView.h
- * @brief This file contains TensorView class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_TENSOR_VIEW_H__
-#define __NNFW_SUPPORT_TFLITE_TENSOR_VIEW_H__
-
-#include "tensorflow/contrib/lite/interpreter.h"
-
-#include "util/tensor/Shape.h"
-#include "util/tensor/Index.h"
-#include "util/tensor/Reader.h"
-#include "util/tensor/NonIncreasingStride.h"
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-
-/**
- * @brief Class to define TensorView which is inherited from nnfw::util::tensor::Reader<T> class
- */
-template<typename T> class TensorView final : public nnfw::util::tensor::Reader<T>
-{
-public:
- /**
- * @brief Construct a TensorView object with base and shape informations
- * @param[in] shape The shape of a tensor
- * @param[in] base The base address of a tensor
- */
- TensorView(const nnfw::util::tensor::Shape &shape, T *base)
- : _shape{shape}, _base{base}
- {
- // Set 'stride'
- _stride.init(_shape);
- }
-
-public:
- /**
- * @brief Get shape of tensor
- * @return Reference of shape
- */
- const nnfw::util::tensor::Shape &shape(void) const { return _shape; }
-
-public:
- /**
- * @brief Get value of tensor index
- * @param[in] index The tensor index
- * @return The value at the index
- */
- T at(const nnfw::util::tensor::Index &index) const override
- {
- const auto offset = _stride.offset(index);
- return *(_base + offset);
- }
-
-public:
- /**
- * @brief Get reference value of tensor index
- * @param[in] index The tensor index
- * @return The reference value at the index
- */
- T &at(const nnfw::util::tensor::Index &index)
- {
- const auto offset = _stride.offset(index);
- return *(_base + offset);
- }
-
-private:
- nnfw::util::tensor::Shape _shape; /**< The tensor shape */
-
-public:
- T *_base; /**< The base address of tensor */
- nnfw::util::tensor::NonIncreasingStride _stride; /**< The NonIncreasingStride object */
-
-public:
- // TODO Introduce Operand ID class
- /**
- * @brief Create TensorView object using given parameters
- * @param[in] interp The TfLite interpreter
- * @param[in] tensor_index The tensor index
- * @return The new TensorView<T> object
- */
- static TensorView<T> make(::tflite::Interpreter &interp, int tensor_index)
- {
- auto tensor_ptr = interp.tensor(tensor_index);
-
- // Set 'shape'
- nnfw::util::tensor::Shape shape(tensor_ptr->dims->size);
-
- for (uint32_t axis = 0; axis < shape.rank(); ++axis)
- {
- shape.dim(axis) = tensor_ptr->dims->data[axis];
- }
-
- return TensorView<T>(shape, interp.typed_tensor<T>(tensor_index));
- }
-};
-
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_TENSOR_VIEW_H__
diff --git a/include/support/tflite/interp/Builder.h b/include/support/tflite/interp/Builder.h
deleted file mode 100644
index 8bfceb67d..000000000
--- a/include/support/tflite/interp/Builder.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Builder.h
- * @brief This file contains Builder structure
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_INTERP_BUILDER_H__
-#define __NNFW_SUPPORT_TFLITE_INTERP_BUILDER_H__
-
-#include <tensorflow/contrib/lite/interpreter.h>
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-namespace interp
-{
-
-/**
- * @brief Structure to Builder
- */
-struct Builder
-{
- /**
- * @brief Destroy the Builder object
- */
- virtual ~Builder() = default;
-
- /**
- * @brief Build a FlatBuffer model
- * @return The TfLite interpreter object
- */
- virtual std::unique_ptr<::tflite::Interpreter> build(void) const = 0;
-};
-
-} // namespace interp
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_INTERP_BUILDER_H__
diff --git a/include/support/tflite/interp/FlatBufferBuilder.h b/include/support/tflite/interp/FlatBufferBuilder.h
deleted file mode 100644
index f7e7b65cd..000000000
--- a/include/support/tflite/interp/FlatBufferBuilder.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file FlatBufferBuilder.h
- * @brief This file contains FlatBufferBuilder class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_INTERP_FLAT_BUFFER_BUILDER_H__
-#define __NNFW_SUPPORT_TFLITE_INTERP_FLAT_BUFFER_BUILDER_H__
-
-#include <tensorflow/contrib/lite/model.h>
-
-#include "support/tflite/interp/Builder.h"
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-namespace interp
-{
-
-/**
- * @brief Class to define FlatBufferBuilder which is inherited from Builder
- */
-class FlatBufferBuilder final : public Builder
-{
-public:
- /**
- * @brief Construct a FlatBufferBuilder object with FlatBufferModel of TfLite
- * @param[in] model The TfLite Flatbuffer model
- */
- FlatBufferBuilder(const ::tflite::FlatBufferModel &model) : _model{model}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Build a FlatBuffer model
- * @return The TfLite interpreter pointer address
- */
- std::unique_ptr<::tflite::Interpreter> build(void) const override;
-
-private:
- const ::tflite::FlatBufferModel &_model;
-};
-
-} // namespace interp
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_INTERP_FLAT_BUFFER_BUILDER_H__
diff --git a/include/support/tflite/interp/FunctionBuilder.h b/include/support/tflite/interp/FunctionBuilder.h
deleted file mode 100644
index 3329a7713..000000000
--- a/include/support/tflite/interp/FunctionBuilder.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file FunctionBuilder.h
- * @brief This file contains FunctionBuilder class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_INTERP_FUNCTION_BUILDER_H__
-#define __NNFW_SUPPORT_TFLITE_INTERP_FUNCTION_BUILDER_H__
-
-#include <tensorflow/contrib/lite/model.h>
-
-#include "support/tflite/interp/Builder.h"
-
-namespace nnfw
-{
-namespace support
-{
-namespace tflite
-{
-namespace interp
-{
-
-/**
- * @brief Class to define FunctionBuilder which is inherited from Builder
- */
-class FunctionBuilder final : public Builder
-{
-public:
- using SetupFunc = std::function<void (::tflite::Interpreter &)>;
-
-public:
- /**
- * @brief Construct a FunctionBuilder object with SetupFunction
- * @param[in] fn The SetupFunc object
- */
- FunctionBuilder(const SetupFunc &fn) : _fn{fn}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Build a SetupFunc
- * @return The TfLite interpreter pointer address
- */
- std::unique_ptr<::tflite::Interpreter> build(void) const override;
-
-private:
- SetupFunc _fn;
-};
-
-} // namespace interp
-} // namespace tflite
-} // namespace support
-} // namespace nnfw
-
-#endif // __NNFW_SUPPORT_TFLITE_INTERP_FUNCTION_BUILDER_H__
diff --git a/include/support/tflite/kernels/Abs.h b/include/support/tflite/kernels/Abs.h
deleted file mode 100644
index e2a639a7d..000000000
--- a/include/support/tflite/kernels/Abs.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_KERNELS_ABS_H__
-#define __NNFW_SUPPORT_TFLITE_KERNELS_ABS_H__
-
-#include "tensorflow/contrib/lite/context.h"
-
-namespace tflite
-{
-namespace ops
-{
-namespace custom
-{
-namespace nnfw
-{
-namespace Abs
-{
-
- void *InitAbs(TfLiteContext *context, const char *buffer, size_t length);
- void FreeAbs(TfLiteContext *context, void *buffer);
- TfLiteStatus PrepareAbs(TfLiteContext *context, TfLiteNode *node);
- TfLiteStatus EvalAbs(TfLiteContext *context, TfLiteNode *node);
-
-} // namespace Abs
-} // namespace nnfw
-} // namespace custom
-} // namespace ops
-} // namespace tflite
-
-#endif
diff --git a/include/support/tflite/kernels/CustomOps.h b/include/support/tflite/kernels/CustomOps.h
deleted file mode 100644
index 131dd237a..000000000
--- a/include/support/tflite/kernels/CustomOps.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file CustomOps.h
- * @brief This file contains registration of custom operands
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_KERNELS_CUSTOM_OP_H__
-#define __NNFW_SUPPORT_TFLITE_KERNELS_CUSTOM_OP_H__
-
-#include "tensorflow/contrib/lite/context.h"
-#include "support/tflite/kernels/TensorFlowMax.h"
-#include "support/tflite/kernels/SquaredDifference.h"
-#include "support/tflite/kernels/TensorFlowSum.h"
-#include "support/tflite/kernels/Abs.h"
-
-namespace tflite
-{
-namespace ops
-{
-namespace custom
-{
-namespace nnfw
-{
-
-#define REGISTER_FUNCTION(Name) \
- TfLiteRegistration *Register_##Name(void) \
- { \
- static TfLiteRegistration r = { Name::Init##Name , Name::Free##Name , Name::Prepare##Name , \
- Name::Eval##Name ,}; \
- r.custom_name = #Name; \
- return &r; \
- }
-
-REGISTER_FUNCTION(TensorFlowMax)
-REGISTER_FUNCTION(SquaredDifference)
-REGISTER_FUNCTION(TensorFlowSum)
-REGISTER_FUNCTION(Abs)
-
-#undef REGISTER_FUNCTION
-
-} // namespace nnfw
-} // namespace custom
-} // namespace ops
-} // namespace tflite
-
-#endif // __NNFW_SUPPORT_TFLITE_KERNELS_CUSTOM_OP_H__
diff --git a/include/support/tflite/kernels/SquaredDifference.h b/include/support/tflite/kernels/SquaredDifference.h
deleted file mode 100644
index f0a97df8d..000000000
--- a/include/support/tflite/kernels/SquaredDifference.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file SquaredDifference.h
- * @brief This file contains SquaredDifference namespace and SquaredDifference function definitions
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_KERNELS_SQUARED_DIFFERENCE_H__
-#define __NNFW_SUPPORT_TFLITE_KERNELS_SQUARED_DIFFERENCE_H__
-
-#include "tensorflow/contrib/lite/context.h"
-
-namespace tflite
-{
-namespace ops
-{
-namespace custom
-{
-namespace nnfw
-{
-namespace SquaredDifference
-{
-
- /**
- * @brief Initialize SquaredDifference operand using the contents of buffer
- * @param[in] context The TfLite context
- * @param[in] buffer The buffer with contents
- * @param[in] length The buffer length
- * @return The void pointer for user data
- */
- void *InitSquaredDifference(TfLiteContext *context, const char *buffer, size_t length);
-
- /**
- * @brief Release any memory it might have allocated via 'InitSquaredDifference'
- * @param[in] context The TfLite context
- * @param[in] buffer The buffer with contents
- * @return N/A
- */
- void FreeSquaredDifference(TfLiteContext *context, void *buffer);
-
- /**
- * @brief Prepare the SquaredDifference operand for execution
- * @param[in] context The TfLite context
- * @param[in] node The operand node
- * @return The TfLite status
- */
- TfLiteStatus PrepareSquaredDifference(TfLiteContext *context, TfLiteNode *node);
-
- /**
- * @brief Evaluation the SquaredDifference operand for execution
- * @param[in] context The TfLite context
- * @param[in] node The operand node
- * @return The TfLite status
- */
- TfLiteStatus EvalSquaredDifference(TfLiteContext *context, TfLiteNode *node);
-
-} // namespace SquaredDifference
-} // namespace nnfw
-} // namespace custom
-} // namespace ops
-} // namespace tflite
-
-#endif
diff --git a/include/support/tflite/kernels/TensorFlowMax.h b/include/support/tflite/kernels/TensorFlowMax.h
deleted file mode 100644
index bd4db772c..000000000
--- a/include/support/tflite/kernels/TensorFlowMax.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file TensorFlowMax.h
- * @brief This file contains TensorFlowMax namespace and TensorFlowMax function definitions
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_KERNELS_TENSORFLOW_MAX_H__
-#define __NNFW_SUPPORT_TFLITE_KERNELS_TENSORFLOW_MAX_H__
-
-#include "tensorflow/contrib/lite/context.h"
-
-namespace tflite
-{
-namespace ops
-{
-namespace custom
-{
-namespace nnfw
-{
-namespace TensorFlowMax
-{
-
- /**
- * @brief Initialize TensorFlowMax operand using the contents of buffer
- * @param[in] context The TfLite context
- * @param[in] buffer The buffer with contents
- * @param[in] length The buffer length
- * @return The void pointer for user data
- */
- void *InitTensorFlowMax(TfLiteContext *context, const char *buffer, size_t length);
-
- /**
- * @brief Release any memory it might have allocated via 'InitTensorFlowMax'
- * @param[in] context The TfLite context
- * @param[in] buffer The buffer with contents
- * @return N/A
- */
- void FreeTensorFlowMax(TfLiteContext *context, void *buffer);
-
- /**
- * @brief Prepare the TensorFlowMax operand for execution
- * @param[in] context The TfLite context
- * @param[in] node The operand node
- * @return The TfLite status
- */
- TfLiteStatus PrepareTensorFlowMax(TfLiteContext *context, TfLiteNode *node);
-
- /**
- * @brief Evaluation the TensorFlowMax operand for execution
- * @param[in] context The TfLite context
- * @param[in] node The operand node
- * @return The TfLite status
- */
- TfLiteStatus EvalTensorFlowMax(TfLiteContext *context, TfLiteNode *node);
-
-} // namespace TensorFlowMax
-} // namespace nnfw
-} // namespace custom
-} // namespace ops
-} // namespace tflite
-
-#endif
diff --git a/include/support/tflite/kernels/TensorFlowSum.h b/include/support/tflite/kernels/TensorFlowSum.h
deleted file mode 100644
index 88a5f2ab9..000000000
--- a/include/support/tflite/kernels/TensorFlowSum.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __NNFW_SUPPORT_TFLITE_KERNELS_TENSORFLOW_SUM_H__
-#define __NNFW_SUPPORT_TFLITE_KERNELS_TENSORFLOW_SUM_H__
-
-#include "tensorflow/contrib/lite/context.h"
-
-namespace tflite
-{
-namespace ops
-{
-namespace custom
-{
-namespace nnfw
-{
-namespace TensorFlowSum
-{
-
- void *InitTensorFlowSum(TfLiteContext *context, const char *buffer, size_t length);
- void FreeTensorFlowSum(TfLiteContext *context, void *buffer);
- TfLiteStatus PrepareTensorFlowSum(TfLiteContext *context, TfLiteNode *node);
- TfLiteStatus EvalTensorFlowSum(TfLiteContext *context, TfLiteNode *node);
-
-} // namespace TensorFlowSum
-} // namespace nnfw
-} // namespace custom
-} // namespace ops
-} // namespace tflite
-
-#endif
diff --git a/include/support/tflite/kernels/register.h b/include/support/tflite/kernels/register.h
deleted file mode 100644
index 43a4c1a23..000000000
--- a/include/support/tflite/kernels/register.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- Copyright 2017 The TensorFlow Authors. All Rights Reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-==============================================================================*/
-
-// NOTE This header is derived from the following file (in TensorFlow)
-// 'externals/tensorflow/tensorflow/contrib/lite/kernels/register.h'
-#ifndef __NNFW_SUPPORT_TFLITE_KERNELS_REGISTER_H__
-#define __NNFW_SUPPORT_TFLITE_KERNELS_REGISTER_H__
-
-#include <unordered_map>
-#include "tensorflow/contrib/lite/context.h"
-#include "tensorflow/contrib/lite/model.h"
-
-// TODO Use namespace nnfw
-namespace tflite {
-namespace ops {
-namespace builtin {
-
-class BuiltinOpResolver : public MutableOpResolver {
- public:
- BuiltinOpResolver();
-};
-
-} // namespace builtin
-} // namespace ops
-} // namespace tflite
-
-#endif // __NNFW_SUPPORT_TFLITE_KERNELS_REGISTER_H__
diff --git a/include/support/tflite/nnapi_delegate.h b/include/support/tflite/nnapi_delegate.h
deleted file mode 100644
index b396d77f2..000000000
--- a/include/support/tflite/nnapi_delegate.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- Copyright 2017 The TensorFlow Authors. All Rights Reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-==============================================================================*/
-
-// NOTE To minimize diff with upstream tensorflow, disable clang-format
-// clang-format off
-
-// NOTE This header is derived from the following file (in TensorFlow v1.12)
-// 'externals/tensorflow/tensorflow/contrib/lite/nnapi_delegate.h'
-#ifndef __NNFW_SUPPORT_TFLITE_NNAPI_DELEGATE_H__
-#define __NNFW_SUPPORT_TFLITE_NNAPI_DELEGATE_H__
-
-#include "tensorflow/contrib/lite/allocation.h"
-#ifdef OBS_BUILD
-#include "tensorflow/contrib/lite/context.h"
-#include "tensorflow/contrib/lite/error_reporter.h"
-#else
-#include "tensorflow/contrib/lite/c/c_api_internal.h"
-#include "tensorflow/contrib/lite/core/api/error_reporter.h"
-#endif
-#include "tensorflow/contrib/lite/interpreter.h"
-#include "NeuralNetworksShim.h"
-
-class ANeuralNetworksModel;
-class ANeuralNetworksMemory;
-class ANeuralNetworksCompilation;
-
-namespace nnfw {
-
-class NNAPIAllocation : public tflite::MMAPAllocation {
- public:
- NNAPIAllocation(const char* filename, ::tflite::ErrorReporter* error_reporter);
- ~NNAPIAllocation();
-
- size_t offset(const void* ptr) const {
- auto signed_offset = reinterpret_cast<const uint8_t*>(ptr) -
- reinterpret_cast<const uint8_t*>(mmapped_buffer_);
-
- return static_cast<size_t>(signed_offset);
- }
-
- ANeuralNetworksMemory* memory() const { return handle_; }
- bool valid() const override { return handle_ != nullptr; }
-
- private:
- mutable ANeuralNetworksMemory* handle_ = nullptr;
-};
-
-class NNAPIDelegate {
- public:
- ~NNAPIDelegate();
-
- // Convert a tflite graph to NNAPI
- TfLiteStatus BuildGraph(::tflite::Interpreter* interpreter);
-
- // Run
- TfLiteStatus Invoke(::tflite::Interpreter* interpreter);
-
- // Whether the current platform supports NNAPI delegation.
- static bool IsSupported();
-
- private:
- // The NN API model handle
- ANeuralNetworksModel* nn_model_ = nullptr;
- // The NN API compilation handle
- ANeuralNetworksCompilation* nn_compiled_model_ = nullptr;
- // Model status
- TfLiteStatus model_status_ = kTfLiteOk;
-
- // List of state tensors for LSTM, RNN, SVDF.
- // NN API does not allow ops to maintain states across multiple
- // invocations. We need to manually create state input tensors from
- // corresponding state output tensors of TFLite operations, and map them
- // correctly.
- std::vector<int> model_states_inputs_; // holds NNAPI operand ids
- std::vector<int> model_states_outputs_; // holds TFLite tensor ids
-};
-
-} // namespace nnfw
-
-#endif // TENSORFLOW_CONTRIB_LITE_NNAPI_DELEGATE_H_
-
-// clang-format on