-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17908 from aabadie/pr/pkg/tflite-micro
pkg/tflite-micro: add support and deprecate tensorflow-lite
- Loading branch information
Showing
39 changed files
with
371 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2022 Inria | ||
# | ||
# This file is subject to the terms and conditions of the GNU Lesser | ||
# General Public License v2.1. See the file LICENSE in the top level | ||
# directory for more details. | ||
|
||
config PACKAGE_RUY | ||
bool "The ruy matrix multiplication library" | ||
depends on TEST_KCONFIG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
PKG_NAME=ruy | ||
PKG_URL=https://github.com/google/ruy | ||
PKG_VERSION=7ef39c5745a61f43071e699c6a96da41701ae59f | ||
PKG_LICENSE=Apache 2.0 | ||
|
||
include $(RIOTBASE)/pkg/pkg.mk | ||
|
||
all: | ||
@: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FEATURES_REQUIRED += cpp | ||
|
||
USEMODULE += cpp11-compat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
INCLUDES += -I$(PKGDIRBASE)/ruy | ||
|
||
PSEUDOMODULES += ruy | ||
|
||
CFLAGS += -DTHIRD_PARTY_RUY_RUY_GTEST_WRAPPER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @defgroup pkg_ruy The ruy matrix multiplication library | ||
* @ingroup pkg | ||
* @brief ruy is a matrix multiplication library | ||
* | ||
* # License | ||
* | ||
* Licensed under Apache 2.0. | ||
* | ||
* @see https://github.com/google/ruy | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MODULE = ruy | ||
|
||
SRCXXEXT = cc | ||
SRCXXEXCLUDE = $(wildcard *_test.$(SRCXXEXT)) | ||
SRCXXEXCLUDE += benchmark.cc pack_%.cc test_%.cc | ||
|
||
CFLAGS += -Wno-unused-variable | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
PKG_NAME=tflite-micro | ||
PKG_URL=https://github.com/tensorflow/tflite-micro | ||
PKG_VERSION=1501b574b74fd7877aba30aa9d8b667f41b139c3 # sync from 2022.04.07 | ||
PKG_LICENSE=Apache 2.0 | ||
|
||
include $(RIOTBASE)/pkg/pkg.mk | ||
|
||
CFLAGS += -Wno-cast-align | ||
CFLAGS += -Wno-maybe-uninitialized | ||
CFLAGS += -Wno-pedantic | ||
CFLAGS += -Wno-unused-parameter | ||
|
||
TFLITE_MODULES := \ | ||
tflite-c \ | ||
tflite-core-api \ | ||
tflite-kernels \ | ||
tflite-kernels-internal \ | ||
tflite-kernels-internal-reference \ | ||
tflite-micro \ | ||
tflite-micro-kernels \ | ||
tflite-micro-memory-planner \ | ||
tflite-schema \ | ||
# | ||
|
||
DIR_tflite-c := tensorflow/lite/c | ||
DIR_tflite-core-api := tensorflow/lite/core/api | ||
DIR_tflite-kernels := tensorflow/lite/kernels | ||
DIR_tflite-kernels-internal := tensorflow/lite/kernels/internal | ||
DIR_tflite-kernels-internal-reference := tensorflow/lite/kernels/internal/reference | ||
DIR_tflite-micro := tensorflow/lite/micro | ||
DIR_tflite-micro-kernels := tensorflow/lite/micro/kernels | ||
DIR_tflite-micro-memory-planner := tensorflow/lite/micro/memory_planner | ||
DIR_tflite-schema := tensorflow/lite/schema | ||
|
||
TFLITE_MODULES_USED := $(filter $(TFLITE_MODULES),$(USEMODULE)) | ||
|
||
all: $(TFLITE_MODULES_USED) | ||
@: | ||
|
||
.PHONY: tflite-% | ||
|
||
tflite-%: | ||
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/$(DIR_$@) -f $(CURDIR)/$@.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FEATURES_REQUIRED += cpp | ||
USEMODULE += cpp11-compat | ||
|
||
USEPKG += flatbuffers | ||
USEPKG += gemmlowp | ||
USEPKG += ruy | ||
|
||
USEMODULE += tflite-c | ||
USEMODULE += tflite-core-api | ||
USEMODULE += tflite-kernels | ||
USEMODULE += tflite-kernels-internal | ||
USEMODULE += tflite-kernels-internal-reference | ||
USEMODULE += tflite-micro | ||
USEMODULE += tflite-micro-kernels | ||
USEMODULE += tflite-micro-memory-planner | ||
USEMODULE += tflite-schema | ||
|
||
# This package doesn't work on riscv and mips | ||
FEATURES_BLACKLIST += arch_mips32r2 arch_riscv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
INCLUDES += -I$(PKGDIRBASE)/tflite-micro | ||
|
||
CFLAGS += -DTF_LITE_STATIC_MEMORY | ||
CFLAGS += -DTF_LITE_DISABLE_X86_NEON | ||
CFLAGS += -DTF_LITE_USE_GLOBAL_CMATH_FUNCTIONS | ||
CFLAGS += -DTF_LITE_USE_GLOBAL_MIN | ||
CFLAGS += -DTF_LITE_USE_GLOBAL_MAX | ||
CFLAGS += -DFLATBUFFERS_LOCALE_INDEPENDENT=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @defgroup pkg_tflite-micro Tensorflow Lite Micro | ||
* @ingroup pkg | ||
* @brief Portable C++ library for signal processing and machine learning inferencing | ||
* | ||
* # License | ||
* | ||
* Licensed under Apache 2.0. | ||
* | ||
* @see https://github.com/tensorflow/tflite-micro | ||
*/ |
40 changes: 40 additions & 0 deletions
40
pkg/tflite-micro/patches/0001-fix-build-with-private-descriptor.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From 4e9723bbedf1317dec204397c6777f90ff76646d Mon Sep 17 00:00:00 2001 | ||
From: Alexandre Abadie <alexandre.abadie@inria.fr> | ||
Date: Thu, 7 Apr 2022 17:07:58 +0200 | ||
Subject: [PATCH 1/1] fix build with private descriptor | ||
|
||
--- | ||
tensorflow/lite/micro/memory_planner/greedy_memory_planner.h | 2 -- | ||
tensorflow/lite/micro/micro_error_reporter.h | 3 --- | ||
2 files changed, 5 deletions(-) | ||
|
||
diff --git a/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h b/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h | ||
index a34f3c5..b8269be 100644 | ||
--- a/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h | ||
+++ b/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h | ||
@@ -158,8 +158,6 @@ class GreedyMemoryPlanner : public MicroMemoryPlanner { | ||
|
||
// Whether buffers have been added since the last plan was calculated. | ||
bool need_to_calculate_offsets_; | ||
- | ||
- TF_LITE_REMOVE_VIRTUAL_DELETE | ||
}; | ||
|
||
} // namespace tflite | ||
diff --git a/tensorflow/lite/micro/micro_error_reporter.h b/tensorflow/lite/micro/micro_error_reporter.h | ||
index 0e3b0c3..18a0d89 100644 | ||
--- a/tensorflow/lite/micro/micro_error_reporter.h | ||
+++ b/tensorflow/lite/micro/micro_error_reporter.h | ||
@@ -46,9 +46,6 @@ class MicroErrorReporter : public ErrorReporter { | ||
public: | ||
~MicroErrorReporter() override {} | ||
int Report(const char* format, va_list args) override; | ||
- | ||
- private: | ||
- TF_LITE_REMOVE_VIRTUAL_DELETE | ||
}; | ||
|
||
} // namespace tflite | ||
-- | ||
2.32.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
MODULE = tflite-c | ||
|
||
SRCXXEXT = cc | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
MODULE = tflite-core-api | ||
|
||
SRCXXEXT = cc | ||
|
||
include $(RIOTBASE)/Makefile.base |
Oops, something went wrong.