Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the sources containing the models from the TFLM static lib. #47018

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tensorflow/lite/micro/benchmarks/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ tensorflow/lite/micro/benchmarks/keyword_benchmark.cc \
tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.cc

KEYWORD_BENCHMARK_HDRS := \
tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.h
tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.h \
tensorflow/lite/micro/benchmarks/micro_benchmark.h

PERSON_DETECTION_BENCHMARK_SRCS := \
tensorflow/lite/micro/benchmarks/person_detection_benchmark.cc \
Expand All @@ -20,4 +21,3 @@ $(KEYWORD_BENCHMARK_SRCS),$(KEYWORD_BENCHMARK_HDRS)))

$(eval $(call microlite_test,person_detection_benchmark,\
$(PERSON_DETECTION_BENCHMARK_SRCS),$(PERSON_DETECTION_BENCHMARK_HDRS)))

50 changes: 47 additions & 3 deletions tensorflow/lite/micro/tools/make/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@ $(wildcard tensorflow/lite/micro/testing/*.h)

MICROLITE_CC_BASE_SRCS := \
$(wildcard tensorflow/lite/micro/*.cc) \
$(wildcard tensorflow/lite/micro/benchmarks/*model_data.cc) \
$(wildcard tensorflow/lite/micro/memory_planner/*.cc) \
$(wildcard tensorflow/lite/micro/testing/*model.cc) \
tensorflow/lite/c/common.c \
tensorflow/lite/core/api/error_reporter.cc \
tensorflow/lite/core/api/flatbuffer_conversions.cc \
Expand Down Expand Up @@ -665,9 +663,55 @@ $(BINDIR)%.bin: $(BINDIR)%
@mkdir -p $(dir $@)
$(OBJCOPY) $< $@ -O binary

# Generate standalone makefile projects for all of the test targets.

# Some tests have additional dependencies (beyond libtensorflow-microlite.a) and
# those need to be explicitly specified with their own individual call to the
# microlite_test helper function. For these tests, we also need to make sure to
# not add targets for them if they have been excluded as part of the target
# specific Makefile.
EXPLICITLY_SPECIFIED_TEST:= tensorflow/lite/micro/memory_arena_threshold_test.cc
ifneq ($(findstring $(EXPLICITLY_SPECIFIED_TEST),$(MICROLITE_TEST_SRCS)),)
MICROLITE_TEST_SRCS := $(filter-out $(EXPLICITLY_SPECIFIED_TEST), $(MICROLITE_TEST_SRCS))
EXPLICITLY_SPECIFIED_TEST_SRCS := \
$(EXPLICITLY_SPECIFIED_TEST) \
tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.cc \
tensorflow/lite/micro/testing/test_conv_model.cc
EXPLICITLY_SPECIFIED_TEST_HDRS := \
tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.h \
tensorflow/lite/micro/testing/test_conv_model.h
$(eval $(call microlite_test,memory_arena_threshold_test,\
$(EXPLICITLY_SPECIFIED_TEST_SRCS),$(EXPLICITLY_SPECIFIED_TEST_HDRS)))
endif

EXPLICITLY_SPECIFIED_TEST:= tensorflow/lite/micro/micro_allocator_test.cc
ifneq ($(findstring $(EXPLICITLY_SPECIFIED_TEST),$(MICROLITE_TEST_SRCS)),)
MICROLITE_TEST_SRCS := $(filter-out $(EXPLICITLY_SPECIFIED_TEST), $(MICROLITE_TEST_SRCS))
EXPLICITLY_SPECIFIED_TEST_SRCS := \
$(EXPLICITLY_SPECIFIED_TEST) \
tensorflow/lite/micro/testing/test_conv_model.cc
EXPLICITLY_SPECIFIED_TEST_HDRS := \
tensorflow/lite/micro/testing/test_conv_model.h
$(eval $(call microlite_test,micro_allocator_test,\
$(EXPLICITLY_SPECIFIED_TEST_SRCS),$(EXPLICITLY_SPECIFIED_TEST_HDRS)))
endif

EXPLICITLY_SPECIFIED_TEST:= tensorflow/lite/micro/recording_micro_allocator_test.cc
ifneq ($(findstring $(EXPLICITLY_SPECIFIED_TEST),$(MICROLITE_TEST_SRCS)),)
MICROLITE_TEST_SRCS := $(filter-out $(EXPLICITLY_SPECIFIED_TEST), $(MICROLITE_TEST_SRCS))
EXPLICITLY_SPECIFIED_TEST_SRCS := \
$(EXPLICITLY_SPECIFIED_TEST) \
tensorflow/lite/micro/testing/test_conv_model.cc
EXPLICITLY_SPECIFIED_TEST_HDRS := \
tensorflow/lite/micro/testing/test_conv_model.h
$(eval $(call microlite_test,recording_micro_allocator_test,\
$(EXPLICITLY_SPECIFIED_TEST_SRCS),$(EXPLICITLY_SPECIFIED_TEST_HDRS)))
endif

# For all the tests that do not have any additional dependencies, we can
# add a make target in a common way.
$(foreach TEST_TARGET,$(filter-out tensorflow/lite/micro/kernels/%,$(MICROLITE_TEST_SRCS)),\
$(eval $(call microlite_test,$(notdir $(basename $(TEST_TARGET))),$(TEST_TARGET))))

$(foreach TEST_TARGET,$(filter tensorflow/lite/micro/kernels/%,$(MICROLITE_TEST_SRCS)),\
$(eval $(call microlite_test,kernel_$(notdir $(basename $(TEST_TARGET))),$(TEST_TARGET))))

Expand Down