diff --git a/python/tflite_micro/BUILD b/python/tflite_micro/BUILD index 8b509b9f93f..7dd5e41d203 100644 --- a/python/tflite_micro/BUILD +++ b/python/tflite_micro/BUILD @@ -4,15 +4,15 @@ load("@rules_python//python:packaging.bzl", "py_package", "py_wheel") load("@tflm_pip_deps//:requirements.bzl", "requirement") load("//python:py_namespace.bzl", "py_namespace") load("//python:py_rules.bzl", "tflm_py_library", "tflm_py_test", "tflm_whl_test") -load( - "//tensorflow:extra_rules.bzl", - "tflm_python_op_resolver_friends", -) load( "//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS", "tflm_cc_library", ) +load( + "//tensorflow/lite/micro:extra_rules.bzl", + "tflm_python_op_resolver_friends", +) load("//tools:expand_stamp_vars.bzl", "expand_stamp_vars") package( diff --git a/python/tflite_micro/compression_utils.h b/python/tflite_micro/compression_utils.h index 9da7484aa55..ea2fd231882 100644 --- a/python/tflite_micro/compression_utils.h +++ b/python/tflite_micro/compression_utils.h @@ -18,7 +18,7 @@ limitations under the License. #include -#include "tensorflow/lite/schema/schema_generated.h" +#include "tensorflow/lite/micro/schema/schema_generated.h" namespace tflite { diff --git a/tensorflow/BUILD b/tensorflow/BUILD deleted file mode 100644 index 5b01f6e3e4c..00000000000 --- a/tensorflow/BUILD +++ /dev/null @@ -1 +0,0 @@ -licenses(["notice"]) diff --git a/tensorflow/lite/micro/BUILD b/tensorflow/lite/micro/BUILD index b7d358cd2c0..a6be9109bc8 100644 --- a/tensorflow/lite/micro/BUILD +++ b/tensorflow/lite/micro/BUILD @@ -43,7 +43,7 @@ tflm_cc_library( ":micro_compatibility", ":micro_log", "//tensorflow/lite/micro/kernels/internal:compatibility", - "//tensorflow/lite/schema:schema_fbs", + "//tensorflow/lite/micro/schema:schema_fbs", ], ) @@ -88,7 +88,6 @@ tflm_cc_library( ":op_resolvers", ":portable_type_to_tflitetype", "//tensorflow/lite/micro/kernels/internal:tensor", - "//tensorflow/lite/schema:schema_fbs", "@flatbuffers//:runtime_cc", ], ) @@ -207,7 +206,6 @@ tflm_cc_library( ":micro_profiler", ":micro_resource_variable", "//tensorflow/lite/micro/kernels/internal:compatibility", - "//tensorflow/lite/schema:schema_fbs", "@flatbuffers//:runtime_cc", ], ) @@ -221,7 +219,6 @@ tflm_cc_library( ":micro_common", ":micro_graph", ":test_helpers", - "//tensorflow/lite/schema:schema_fbs", ], ) @@ -253,7 +250,6 @@ tflm_cc_library( "//tensorflow/lite/micro/memory_planner:greedy_memory_planner", "//tensorflow/lite/micro/memory_planner:linear_memory_planner", "//tensorflow/lite/micro/memory_planner:micro_memory_planner", - "//tensorflow/lite/schema:schema_fbs", "@flatbuffers//:runtime_cc", ], ) @@ -273,7 +269,7 @@ tflm_cc_library( deps = [ ":micro_common", "//tensorflow/lite/micro/kernels/internal:compatibility", - "//tensorflow/lite/schema:schema_fbs", + "//tensorflow/lite/micro/schema:schema_fbs", "@flatbuffers//:runtime_cc", ], ) @@ -287,7 +283,7 @@ tflm_cc_library( ":micro_common", "//tensorflow/lite/micro/kernels/internal:compatibility", "//tensorflow/lite/micro/kernels/internal:tensor", - "//tensorflow/lite/schema:schema_fbs", + "//tensorflow/lite/micro/schema:schema_fbs", "@flatbuffers//:runtime_cc", ], ) @@ -313,7 +309,6 @@ tflm_cc_library( "//tensorflow/lite/micro/kernels:kernel_util", "//tensorflow/lite/micro/kernels/internal:compatibility", "//tensorflow/lite/micro/kernels/internal:tensor", - "//tensorflow/lite/schema:schema_fbs", "@flatbuffers//:runtime_cc", ], ) @@ -336,7 +331,6 @@ tflm_cc_library( "//tensorflow/lite/micro/kernels:micro_ops", "//tensorflow/lite/micro/kernels:op_macros", "//tensorflow/lite/micro/kernels/internal:compatibility", - "//tensorflow/lite/schema:schema_fbs", ], ) diff --git a/tensorflow/lite/micro/benchmarks/BUILD b/tensorflow/lite/micro/benchmarks/BUILD index 7e8480d350b..2c059781d13 100644 --- a/tensorflow/lite/micro/benchmarks/BUILD +++ b/tensorflow/lite/micro/benchmarks/BUILD @@ -103,6 +103,5 @@ tflm_cc_binary( "//tensorflow/lite/micro/examples/person_detection:model_settings", "//tensorflow/lite/micro/examples/person_detection:person_detect_model_data", "//tensorflow/lite/micro/examples/person_detection:simple_images_test_data", - "//tensorflow/lite/schema:schema_fbs", ], ) diff --git a/tensorflow/lite/micro/benchmarks/person_detection_benchmark.cc b/tensorflow/lite/micro/benchmarks/person_detection_benchmark.cc index bb4b9bd5f66..a5042e333ca 100644 --- a/tensorflow/lite/micro/benchmarks/person_detection_benchmark.cc +++ b/tensorflow/lite/micro/benchmarks/person_detection_benchmark.cc @@ -27,7 +27,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_utils.h" #include "tensorflow/lite/micro/models/person_detect_model_data.h" #include "tensorflow/lite/micro/system_setup.h" -#include "tensorflow/lite/schema/schema_generated.h" /* * Person Detection benchmark. Evaluates runtime performance of the visual diff --git a/tensorflow/lite/micro/examples/dtln/dtln_test.cc b/tensorflow/lite/micro/examples/dtln/dtln_test.cc index d3f9d57dab7..a9d5506b330 100644 --- a/tensorflow/lite/micro/examples/dtln/dtln_test.cc +++ b/tensorflow/lite/micro/examples/dtln/dtln_test.cc @@ -20,7 +20,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/testing/micro_test_v2.h" -#include "tensorflow/lite/schema/schema_generated.h" TEST(DtlnTest, TestInvoke) { MicroPrintf( diff --git a/tensorflow/lite/micro/examples/hello_world/BUILD b/tensorflow/lite/micro/examples/hello_world/BUILD index 483e2df1bc5..61015d8731d 100644 --- a/tensorflow/lite/micro/examples/hello_world/BUILD +++ b/tensorflow/lite/micro/examples/hello_world/BUILD @@ -37,7 +37,6 @@ tflm_cc_test( "//tensorflow/lite/micro:op_resolvers", "//tensorflow/lite/micro:recording_allocators", "//tensorflow/lite/micro/testing:micro_test", - "//tensorflow/lite/schema:schema_fbs", ], ) diff --git a/tensorflow/lite/micro/examples/hello_world/hello_world_test.cc b/tensorflow/lite/micro/examples/hello_world/hello_world_test.cc index 9f694dc2514..83bd2f25e3d 100644 --- a/tensorflow/lite/micro/examples/hello_world/hello_world_test.cc +++ b/tensorflow/lite/micro/examples/hello_world/hello_world_test.cc @@ -24,7 +24,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_profiler.h" #include "tensorflow/lite/micro/recording_micro_interpreter.h" #include "tensorflow/lite/micro/system_setup.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace { using HelloWorldOpResolver = tflite::MicroMutableOpResolver<1>; diff --git a/tensorflow/lite/micro/examples/micro_speech/BUILD b/tensorflow/lite/micro/examples/micro_speech/BUILD index d75f07728c0..9a9e1faac16 100644 --- a/tensorflow/lite/micro/examples/micro_speech/BUILD +++ b/tensorflow/lite/micro/examples/micro_speech/BUILD @@ -184,7 +184,6 @@ tflm_cc_test( "//tensorflow/lite/micro:micro_log", "//tensorflow/lite/micro:op_resolvers", "//tensorflow/lite/micro/testing:micro_test", - "//tensorflow/lite/schema:schema_fbs", ], ) diff --git a/tensorflow/lite/micro/examples/network_tester/network_tester_test.cc b/tensorflow/lite/micro/examples/network_tester/network_tester_test.cc index bb073eff073..a7a6d6c2829 100644 --- a/tensorflow/lite/micro/examples/network_tester/network_tester_test.cc +++ b/tensorflow/lite/micro/examples/network_tester/network_tester_test.cc @@ -21,7 +21,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/micro_utils.h" #include "tensorflow/lite/micro/testing/micro_test_v2.h" -#include "tensorflow/lite/schema/schema_generated.h" #ifdef ETHOS_U #include "tensorflow/lite/micro/examples/person_detection/testdata/person_image_data.h" diff --git a/tensorflow/lite/micro/examples/person_detection/BUILD b/tensorflow/lite/micro/examples/person_detection/BUILD index 8be05bfdcef..e78209c3f5e 100644 --- a/tensorflow/lite/micro/examples/person_detection/BUILD +++ b/tensorflow/lite/micro/examples/person_detection/BUILD @@ -86,7 +86,6 @@ tflm_cc_test( "//tensorflow/lite/micro:micro_log", "//tensorflow/lite/micro:op_resolvers", "//tensorflow/lite/micro/testing:micro_test", - "//tensorflow/lite/schema:schema_fbs", ], ) @@ -158,6 +157,5 @@ tflm_cc_binary( "//tensorflow/lite/micro:micro_log", "//tensorflow/lite/micro:op_resolvers", "//tensorflow/lite/micro:system_setup", - "//tensorflow/lite/schema:schema_fbs", ], ) diff --git a/tensorflow/lite/micro/examples/person_detection/main_functions.cc b/tensorflow/lite/micro/examples/person_detection/main_functions.cc index f91a1a3828f..3ac344f0116 100644 --- a/tensorflow/lite/micro/examples/person_detection/main_functions.cc +++ b/tensorflow/lite/micro/examples/person_detection/main_functions.cc @@ -23,7 +23,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/models/person_detect_model_data.h" #include "tensorflow/lite/micro/system_setup.h" -#include "tensorflow/lite/schema/schema_generated.h" // Globals, used for compatibility with Arduino-style sketches. namespace { diff --git a/tensorflow/lite/micro/examples/person_detection/person_detection_test.cc b/tensorflow/lite/micro/examples/person_detection/person_detection_test.cc index 783e3278a2d..63d25394c6a 100644 --- a/tensorflow/lite/micro/examples/person_detection/person_detection_test.cc +++ b/tensorflow/lite/micro/examples/person_detection/person_detection_test.cc @@ -22,7 +22,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/models/person_detect_model_data.h" #include "tensorflow/lite/micro/testing/micro_test_v2.h" -#include "tensorflow/lite/schema/schema_generated.h" // Create an area of memory to use for input, output, and intermediate arrays. #if defined(XTENSA) && defined(VISION_P6) diff --git a/tensorflow/extra_rules.bzl b/tensorflow/lite/micro/extra_rules.bzl similarity index 100% rename from tensorflow/extra_rules.bzl rename to tensorflow/lite/micro/extra_rules.bzl diff --git a/tensorflow/lite/micro/flatbuffer_conversions.cc b/tensorflow/lite/micro/flatbuffer_conversions.cc index 695f0261119..854019a1531 100644 --- a/tensorflow/lite/micro/flatbuffer_conversions.cc +++ b/tensorflow/lite/micro/flatbuffer_conversions.cc @@ -33,7 +33,6 @@ limitations under the License. #include "tensorflow/lite/micro/compatibility.h" #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_log.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/flatbuffer_conversions.h b/tensorflow/lite/micro/flatbuffer_conversions.h index 28737634bd8..38e657187c6 100644 --- a/tensorflow/lite/micro/flatbuffer_conversions.h +++ b/tensorflow/lite/micro/flatbuffer_conversions.h @@ -32,7 +32,7 @@ limitations under the License. #include #include "tensorflow/lite/micro/micro_common.h" -#include "tensorflow/lite/schema/schema_generated.h" +#include "tensorflow/lite/micro/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/flatbuffer_utils.h b/tensorflow/lite/micro/flatbuffer_utils.h index 759687c087e..046b090b02d 100644 --- a/tensorflow/lite/micro/flatbuffer_utils.h +++ b/tensorflow/lite/micro/flatbuffer_utils.h @@ -19,7 +19,7 @@ limitations under the License. #include "flatbuffers/flatbuffers.h" #include "flatbuffers/flexbuffers.h" #include "tensorflow/lite/micro/micro_common.h" -#include "tensorflow/lite/schema/schema_generated.h" +#include "tensorflow/lite/micro/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/kernels/BUILD b/tensorflow/lite/micro/kernels/BUILD index 391b73d1c04..9fd2f4aef4d 100644 --- a/tensorflow/lite/micro/kernels/BUILD +++ b/tensorflow/lite/micro/kernels/BUILD @@ -1,13 +1,4 @@ load("@bazel_skylib//rules:common_settings.bzl", "string_flag") -load( - "//tensorflow:extra_rules.bzl", - "tflm_kernel_friends", - "xtensa_fusion_f1_config", - "xtensa_hifi_3_config", - "xtensa_hifi_3z_config", - "xtensa_hifi_5_config", - "xtensa_vision_p6_config", -) load( "//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS", @@ -16,6 +7,15 @@ load( "tflm_copts", "tflm_kernel_cc_library", ) +load( + "//tensorflow/lite/micro:extra_rules.bzl", + "tflm_kernel_friends", + "xtensa_fusion_f1_config", + "xtensa_hifi_3_config", + "xtensa_hifi_3z_config", + "xtensa_hifi_5_config", + "xtensa_vision_p6_config", +) package( features = [ @@ -441,7 +441,6 @@ tflm_kernel_cc_library( "//tensorflow/lite/micro/kernels/internal:tensor", "//tensorflow/lite/micro/kernels/internal:tensor_utils_no_eigen", "//tensorflow/lite/micro/kernels/internal:types", - "//tensorflow/lite/schema:schema_fbs", "@flatbuffers//:runtime_cc", ] + select({ xtensa_fusion_f1_config(): ["//third_party/xtensa/nnlib_hifi4:nnlib_hifi4_lib"], diff --git a/tensorflow/lite/micro/kernels/assign_variable.cc b/tensorflow/lite/micro/kernels/assign_variable.cc index 90d162be2f1..7d653e02d06 100644 --- a/tensorflow/lite/micro/kernels/assign_variable.cc +++ b/tensorflow/lite/micro/kernels/assign_variable.cc @@ -26,7 +26,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_resource_variable.h" #include "tensorflow/lite/micro/micro_utils.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/kernels/call_once.cc b/tensorflow/lite/micro/kernels/call_once.cc index d51b2fa95ec..8d712768221 100644 --- a/tensorflow/lite/micro/kernels/call_once.cc +++ b/tensorflow/lite/micro/kernels/call_once.cc @@ -24,7 +24,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_context.h" #include "tensorflow/lite/micro/micro_graph.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/kernels/if.cc b/tensorflow/lite/micro/kernels/if.cc index 3deb8f9f216..0c6f13b81a1 100644 --- a/tensorflow/lite/micro/kernels/if.cc +++ b/tensorflow/lite/micro/kernels/if.cc @@ -24,7 +24,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_context.h" #include "tensorflow/lite/micro/micro_graph.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/kernels/read_variable.cc b/tensorflow/lite/micro/kernels/read_variable.cc index 832a738a608..f174166b6a8 100644 --- a/tensorflow/lite/micro/kernels/read_variable.cc +++ b/tensorflow/lite/micro/kernels/read_variable.cc @@ -25,7 +25,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_graph.h" #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_resource_variable.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/kernels/var_handle.cc b/tensorflow/lite/micro/kernels/var_handle.cc index 6a4bccbcb5c..740fda3beb2 100644 --- a/tensorflow/lite/micro/kernels/var_handle.cc +++ b/tensorflow/lite/micro/kernels/var_handle.cc @@ -25,7 +25,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_graph.h" #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_resource_variable.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/memory_helpers.cc b/tensorflow/lite/micro/memory_helpers.cc index 32ec11e29fd..0e40af2d949 100644 --- a/tensorflow/lite/micro/memory_helpers.cc +++ b/tensorflow/lite/micro/memory_helpers.cc @@ -22,7 +22,6 @@ limitations under the License. #include "tensorflow/lite/micro/flatbuffer_conversions.h" #include "tensorflow/lite/micro/kernels/internal/compatibility.h" #include "tensorflow/lite/micro/micro_common.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/memory_helpers.h b/tensorflow/lite/micro/memory_helpers.h index 2c2bc852539..f74b3ab5417 100644 --- a/tensorflow/lite/micro/memory_helpers.h +++ b/tensorflow/lite/micro/memory_helpers.h @@ -19,7 +19,7 @@ limitations under the License. #include #include "tensorflow/lite/micro/micro_common.h" -#include "tensorflow/lite/schema/schema_generated.h" +#include "tensorflow/lite/micro/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/micro_allocation_info.h b/tensorflow/lite/micro/micro_allocation_info.h index 6f3f626131a..24d0eea2fd2 100644 --- a/tensorflow/lite/micro/micro_allocation_info.h +++ b/tensorflow/lite/micro/micro_allocation_info.h @@ -19,7 +19,6 @@ limitations under the License. #include "tensorflow/lite/micro/flatbuffer_utils.h" #include "tensorflow/lite/micro/micro_allocator.h" #include "tensorflow/lite/micro/micro_common.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/micro_allocator.cc b/tensorflow/lite/micro/micro_allocator.cc index a03b6b48a88..fdfb28970db 100644 --- a/tensorflow/lite/micro/micro_allocator.cc +++ b/tensorflow/lite/micro/micro_allocator.cc @@ -34,7 +34,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_arena_constants.h" #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_log.h" -#include "tensorflow/lite/schema/schema_generated.h" #ifdef USE_TFLM_COMPRESSION diff --git a/tensorflow/lite/micro/micro_allocator.h b/tensorflow/lite/micro/micro_allocator.h index 34d903437f7..0caf32a663d 100644 --- a/tensorflow/lite/micro/micro_allocator.h +++ b/tensorflow/lite/micro/micro_allocator.h @@ -24,7 +24,6 @@ limitations under the License. #include "tensorflow/lite/micro/flatbuffer_utils.h" #include "tensorflow/lite/micro/memory_planner/micro_memory_planner.h" #include "tensorflow/lite/micro/micro_common.h" -#include "tensorflow/lite/schema/schema_generated.h" #ifdef USE_TFLM_COMPRESSION diff --git a/tensorflow/lite/micro/micro_interpreter.cc b/tensorflow/lite/micro/micro_interpreter.cc index d6963144784..1c7f1c0fab5 100644 --- a/tensorflow/lite/micro/micro_interpreter.cc +++ b/tensorflow/lite/micro/micro_interpreter.cc @@ -28,7 +28,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_op_resolver.h" #include "tensorflow/lite/micro/micro_profiler_interface.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/micro_interpreter.h b/tensorflow/lite/micro/micro_interpreter.h index 56aa87c32f6..2bcbdf47a63 100644 --- a/tensorflow/lite/micro/micro_interpreter.h +++ b/tensorflow/lite/micro/micro_interpreter.h @@ -33,7 +33,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_op_resolver.h" #include "tensorflow/lite/micro/micro_profiler_interface.h" #include "tensorflow/lite/micro/portable_type_to_tflitetype.h" -#include "tensorflow/lite/schema/schema_generated.h" /// Copied from tensorflow/lite/version.h to avoid a dependency chain into // tensorflow/core. diff --git a/tensorflow/lite/micro/micro_interpreter_graph.cc b/tensorflow/lite/micro/micro_interpreter_graph.cc index 797a58fbf57..1e294e92e2c 100644 --- a/tensorflow/lite/micro/micro_interpreter_graph.cc +++ b/tensorflow/lite/micro/micro_interpreter_graph.cc @@ -25,7 +25,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_context.h" #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_profiler.h" -#include "tensorflow/lite/schema/schema_generated.h" #ifdef USE_TFLM_COMPRESSION diff --git a/tensorflow/lite/micro/micro_interpreter_graph.h b/tensorflow/lite/micro/micro_interpreter_graph.h index cc4add79bf2..dc1625c51ef 100644 --- a/tensorflow/lite/micro/micro_interpreter_graph.h +++ b/tensorflow/lite/micro/micro_interpreter_graph.h @@ -21,7 +21,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_graph.h" #include "tensorflow/lite/micro/micro_profiler_interface.h" #include "tensorflow/lite/micro/micro_resource_variable.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/micro_mutable_op_resolver.h b/tensorflow/lite/micro/micro_mutable_op_resolver.h index 7917be4778f..2ccac1fe336 100644 --- a/tensorflow/lite/micro/micro_mutable_op_resolver.h +++ b/tensorflow/lite/micro/micro_mutable_op_resolver.h @@ -42,7 +42,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_op_resolver.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/micro_op_resolver.h b/tensorflow/lite/micro/micro_op_resolver.h index 97e8385e3c5..cbb0777e23b 100644 --- a/tensorflow/lite/micro/micro_op_resolver.h +++ b/tensorflow/lite/micro/micro_op_resolver.h @@ -17,7 +17,6 @@ limitations under the License. #include "tensorflow/lite/micro/flatbuffer_conversions.h" #include "tensorflow/lite/micro/micro_common.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/mock_micro_graph.h b/tensorflow/lite/micro/mock_micro_graph.h index da0758f33fb..9c992beb868 100644 --- a/tensorflow/lite/micro/mock_micro_graph.h +++ b/tensorflow/lite/micro/mock_micro_graph.h @@ -19,7 +19,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_allocator.h" #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_graph.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/micro/python/BUILD b/tensorflow/lite/micro/python/BUILD index bac3a0e354d..c165a57cfa1 100644 --- a/tensorflow/lite/micro/python/BUILD +++ b/tensorflow/lite/micro/python/BUILD @@ -11,7 +11,7 @@ package( flatbuffer_py_library( name = "schema_py", - srcs = ["//tensorflow/lite/schema:schema.fbs"], + srcs = ["//tensorflow/lite/micro/schema:schema.fbs"], ) tflm_py_library( diff --git a/tensorflow/lite/micro/python/interpreter/src/BUILD b/tensorflow/lite/micro/python/interpreter/src/BUILD index 1d3e0bd46f8..de5c33d8991 100644 --- a/tensorflow/lite/micro/python/interpreter/src/BUILD +++ b/tensorflow/lite/micro/python/interpreter/src/BUILD @@ -1,11 +1,11 @@ -load( - "//tensorflow:extra_rules.bzl", - "tflm_python_op_resolver_friends", -) load( "//tensorflow/lite/micro:build_def.bzl", "tflm_cc_library", ) +load( + "//tensorflow/lite/micro:extra_rules.bzl", + "tflm_python_op_resolver_friends", +) package( features = ["-layering_check"], diff --git a/tensorflow/lite/micro/python/tflite_size/README.md b/tensorflow/lite/micro/python/tflite_size/README.md index 173d2872a29..1cffe598d5c 100644 --- a/tensorflow/lite/micro/python/tflite_size/README.md +++ b/tensorflow/lite/micro/python/tflite_size/README.md @@ -22,6 +22,6 @@ collapsibly list so that you can zoom in/out individual structure based on need. ## How to update `schema_generated_with_reflective_type.h` We generate our own schema_generated_with_reflective, using the build target in -tensorflow/lite/schema:schema_fbs_with_reflection (call with: +tensorflow/lite/micro/schema:schema_fbs_with_reflection (call with: bazel build schema_fbs_with_reflection_srcs). diff --git a/tensorflow/lite/micro/python/tflite_size/src/BUILD b/tensorflow/lite/micro/python/tflite_size/src/BUILD index 62892f4e598..9bbf1fc6b87 100644 --- a/tensorflow/lite/micro/python/tflite_size/src/BUILD +++ b/tensorflow/lite/micro/python/tflite_size/src/BUILD @@ -20,7 +20,7 @@ pybind_library( "flatbuffer_size_wrapper.h", ], deps = [ - "//tensorflow/lite/schema:schema_fbs_with_reflection", + "//tensorflow/lite/micro/schema:schema_fbs_with_reflection", "@flatbuffers", ], ) diff --git a/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size_wrapper.cc b/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size_wrapper.cc index a78e8eaeb9e..1a3ac0ea0cf 100644 --- a/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size_wrapper.cc +++ b/tensorflow/lite/micro/python/tflite_size/src/flatbuffer_size_wrapper.cc @@ -18,7 +18,7 @@ limitations under the License. #include #include "flatbuffer_size.h" -#include "tensorflow/lite/schema/reflection/schema_generated.h" +#include "tensorflow/lite/micro/schema/reflection/schema_generated.h" namespace tflite { namespace micro { diff --git a/tensorflow/lite/schema/BUILD b/tensorflow/lite/micro/schema/BUILD similarity index 100% rename from tensorflow/lite/schema/BUILD rename to tensorflow/lite/micro/schema/BUILD diff --git a/tensorflow/lite/schema/schema.fbs b/tensorflow/lite/micro/schema/schema.fbs similarity index 100% rename from tensorflow/lite/schema/schema.fbs rename to tensorflow/lite/micro/schema/schema.fbs diff --git a/tensorflow/lite/schema/schema_generated.h b/tensorflow/lite/micro/schema/schema_generated.h similarity index 100% rename from tensorflow/lite/schema/schema_generated.h rename to tensorflow/lite/micro/schema/schema_generated.h diff --git a/tensorflow/lite/micro/test_helper_custom_ops.cc b/tensorflow/lite/micro/test_helper_custom_ops.cc index 89b6673e818..ed0c4781a9e 100644 --- a/tensorflow/lite/micro/test_helper_custom_ops.cc +++ b/tensorflow/lite/micro/test_helper_custom_ops.cc @@ -28,7 +28,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_utils.h" -#include "tensorflow/lite/schema/schema_generated.h" // TODO(b/170464050): Use TFLM test only version of schema_utils. diff --git a/tensorflow/lite/micro/test_helper_custom_ops.h b/tensorflow/lite/micro/test_helper_custom_ops.h index 0e5fd884fb2..bb90189bbcd 100644 --- a/tensorflow/lite/micro/test_helper_custom_ops.h +++ b/tensorflow/lite/micro/test_helper_custom_ops.h @@ -25,7 +25,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_utils.h" #include "tensorflow/lite/micro/portable_type_to_tflitetype.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { namespace testing { diff --git a/tensorflow/lite/micro/test_helpers.cc b/tensorflow/lite/micro/test_helpers.cc index f9010bb8931..c70bc101daf 100644 --- a/tensorflow/lite/micro/test_helpers.cc +++ b/tensorflow/lite/micro/test_helpers.cc @@ -31,7 +31,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_common.h" #include "tensorflow/lite/micro/micro_utils.h" #include "tensorflow/lite/micro/test_helper_custom_ops.h" -#include "tensorflow/lite/schema/schema_generated.h" #ifdef USE_TFLM_COMPRESSION diff --git a/tensorflow/lite/micro/test_helpers.h b/tensorflow/lite/micro/test_helpers.h index bb24423555d..2b1bf359f1c 100644 --- a/tensorflow/lite/micro/test_helpers.h +++ b/tensorflow/lite/micro/test_helpers.h @@ -31,7 +31,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/micro_utils.h" #include "tensorflow/lite/micro/portable_type_to_tflitetype.h" -#include "tensorflow/lite/schema/schema_generated.h" #ifdef USE_TFLM_COMPRESSION diff --git a/tensorflow/lite/micro/testing/BUILD b/tensorflow/lite/micro/testing/BUILD index 0540c36de17..1253e784712 100644 --- a/tensorflow/lite/micro/testing/BUILD +++ b/tensorflow/lite/micro/testing/BUILD @@ -1,13 +1,13 @@ load("//python:py_rules.bzl", "tflm_py_binary", "tflm_py_library") -load( - "//tensorflow:extra_rules.bzl", - "tflm_kernel_friends", -) load( "//tensorflow/lite/micro:build_def.bzl", "tflm_cc_library", "tflm_cc_test", ) +load( + "//tensorflow/lite/micro:extra_rules.bzl", + "tflm_kernel_friends", +) package( # Disabling layering_check because of http://b/177257332 diff --git a/tensorflow/lite/micro/tools/BUILD b/tensorflow/lite/micro/tools/BUILD index fcf7c349a97..e0b284a0da5 100644 --- a/tensorflow/lite/micro/tools/BUILD +++ b/tensorflow/lite/micro/tools/BUILD @@ -7,8 +7,8 @@ load( "tflm_py_library", "tflm_py_test", ) -load("//tensorflow:extra_rules.bzl", "tflm_application_friends") load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") +load("//tensorflow/lite/micro:extra_rules.bzl", "tflm_application_friends") load("//third_party/flatbuffers:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library") package( @@ -151,7 +151,7 @@ pybind_extension( ], target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ - "//tensorflow/lite/schema:schema_fbs", + "//tensorflow/lite/micro/schema:schema_fbs", "@flatbuffers", ], ) @@ -222,8 +222,8 @@ cc_binary( "//tensorflow/lite/micro:op_resolvers", "//tensorflow/lite/micro/kernels:kernel_util", "//tensorflow/lite/micro/kernels:op_macros", + "//tensorflow/lite/micro/schema:schema_fbs", "//tensorflow/lite/micro/tools/benchmarking:op_resolver", - "//tensorflow/lite/schema:schema_fbs", "@flatbuffers", ], ) diff --git a/tensorflow/lite/micro/tools/benchmarking/BUILD b/tensorflow/lite/micro/tools/benchmarking/BUILD index 10a49d646d4..0dac511f399 100644 --- a/tensorflow/lite/micro/tools/benchmarking/BUILD +++ b/tensorflow/lite/micro/tools/benchmarking/BUILD @@ -39,7 +39,6 @@ tflm_cc_library( "//tensorflow/lite/micro:op_resolvers", "//tensorflow/lite/micro:recording_allocators", "//tensorflow/lite/micro:system_setup", - "//tensorflow/lite/schema:schema_fbs", ], ) diff --git a/tensorflow/lite/micro/tools/benchmarking/generic_model_benchmark.cc b/tensorflow/lite/micro/tools/benchmarking/generic_model_benchmark.cc index 4ee8b8efa49..1eb5480f905 100644 --- a/tensorflow/lite/micro/tools/benchmarking/generic_model_benchmark.cc +++ b/tensorflow/lite/micro/tools/benchmarking/generic_model_benchmark.cc @@ -37,7 +37,6 @@ limitations under the License. #include "tensorflow/lite/micro/tools/benchmarking/metrics.h" #include "tensorflow/lite/micro/tools/benchmarking/op_resolver.h" #include "tensorflow/lite/micro/tools/benchmarking/show_meta_data.h" -#include "tensorflow/lite/schema/schema_generated.h" #if defined(GENERIC_BENCHMARK_USING_BUILTIN_MODEL) #if !defined(GENERIC_BENCHMARK_MODEL_HEADER_PATH) diff --git a/tensorflow/lite/micro/tools/ci_build/check_license.py b/tensorflow/lite/micro/tools/ci_build/check_license.py index 2921f4df3fe..a10b62a31a5 100755 --- a/tensorflow/lite/micro/tools/ci_build/check_license.py +++ b/tensorflow/lite/micro/tools/ci_build/check_license.py @@ -30,6 +30,7 @@ "kernels/internal/reference/reference_ops.h", "python/schema_py_generated.py", "python_requirements.in", + "schema/schema_generated.h", "tensorflow/lite/micro/compression/metadata_saved.h", "tools/make/downloads", "tools/make/targets/ecm3531", diff --git a/tensorflow/lite/micro/tools/ci_build/test_clang_tidy.sh b/tensorflow/lite/micro/tools/ci_build/test_clang_tidy.sh index 3e361a76b6c..c968d63c291 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_clang_tidy.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_clang_tidy.sh @@ -129,6 +129,7 @@ git diff -U0 --diff-filter=d "${MERGE_BASE}" -- \ ':(exclude)tensorflow/lite/micro/hexagon/*' \ ':(exclude)tensorflow/lite/micro/riscv32_generic/*' \ ':(exclude)tensorflow/lite/micro/python/*' \ + ':(exclude)tensorflow/lite/micro/tools/tflite_flatbuffer_align_wrapper.cc' \ ':(exclude)tensorflow/lite/micro/examples/*' \ ':(exclude)tensorflow/lite/micro/integration_tests/*' \ ':(exclude)tensorflow/lite/micro/benchmarks/*' \ diff --git a/tensorflow/lite/micro/tools/flatbuffer_utils.py b/tensorflow/lite/micro/tools/flatbuffer_utils.py index 98750f1be28..976cbbd2ee1 100644 --- a/tensorflow/lite/micro/tools/flatbuffer_utils.py +++ b/tensorflow/lite/micro/tools/flatbuffer_utils.py @@ -17,7 +17,7 @@ All functions that are commonly used to work with FlatBuffers. Refer to the tensorflow lite flatbuffer schema here: -tensorflow/lite/schema/schema.fbs +tensorflow/lite/micro/schema/schema.fbs """ import copy diff --git a/tensorflow/lite/micro/tools/layer_by_layer.cc b/tensorflow/lite/micro/tools/layer_by_layer.cc index c789e13c7ba..3b41526b7af 100644 --- a/tensorflow/lite/micro/tools/layer_by_layer.cc +++ b/tensorflow/lite/micro/tools/layer_by_layer.cc @@ -38,9 +38,9 @@ limitations under the License. #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/micro_resource_variable.h" #include "tensorflow/lite/micro/micro_utils.h" +#include "tensorflow/lite/micro/schema/schema_generated.h" #include "tensorflow/lite/micro/tools/benchmarking/op_resolver.h" #include "tensorflow/lite/micro/tools/layer_by_layer_schema_generated.h" -#include "tensorflow/lite/schema/schema_generated.h" namespace tflite { diff --git a/tensorflow/lite/micro/tools/make/sources.inc b/tensorflow/lite/micro/tools/make/sources.inc index fcd923b7710..271cf6506f4 100644 --- a/tensorflow/lite/micro/tools/make/sources.inc +++ b/tensorflow/lite/micro/tools/make/sources.inc @@ -19,7 +19,7 @@ MICROLITE_CC_HDRS := \ $(wildcard $(TENSORFLOW_ROOT)tensorflow/lite/micro/kernels/internal/reference/integer_ops/*.h) \ $(wildcard $(TENSORFLOW_ROOT)tensorflow/lite/micro/arena_allocator/*.h) \ $(wildcard $(TENSORFLOW_ROOT)tensorflow/lite/micro/memory_planner/*.h) \ - $(TENSORFLOW_ROOT)tensorflow/lite/schema/schema_generated.h \ + $(TENSORFLOW_ROOT)tensorflow/lite/micro/schema/schema_generated.h \ $(TENSORFLOW_ROOT)LICENSE # some kiss fft source file has to be included in header sections because diff --git a/tensorflow/lite/micro/tools/requantize_flatbuffer.py b/tensorflow/lite/micro/tools/requantize_flatbuffer.py index e5a50490a75..6723e23ded0 100644 --- a/tensorflow/lite/micro/tools/requantize_flatbuffer.py +++ b/tensorflow/lite/micro/tools/requantize_flatbuffer.py @@ -45,7 +45,7 @@ from tflite_micro.tensorflow.lite.micro.tools import requantize_flatbuffer_utils from tflite_micro.tensorflow.lite.micro.python import schema_py_generated -# key: BuiltinOperator (see tensorflow/lite/schema/schema.fbs) +# key: BuiltinOperator (see tensorflow/lite/micro/schema/schema.fbs) # Val: the requantize function defined in requantize_flatbuffer_utils.py # FULLY_CONNECTED, CONV_2D, DEPTHWISE_CONV_2D share the same requantize function # since they all share the same input/weight/bias configuration. @@ -58,7 +58,7 @@ schema_py_generated.BuiltinOperator.TRANSPOSE_CONV: requantize_flatbuffer_utils.requantize_transpose_conv, } -# List of tested simple operators (no weight and bias, e.g., reshape) see tensorflow/lite/schema/schema.fbs for op code names +# List of tested simple operators (no weight and bias, e.g., reshape) see tensorflow/lite/micro/schema/schema.fbs for op code names _TESTED_SIMPLE_OPS = [ schema_py_generated.BuiltinOperator.ADD, schema_py_generated.BuiltinOperator.CONCATENATION, diff --git a/tensorflow/lite/micro/tools/requantize_flatbuffer_utils.py b/tensorflow/lite/micro/tools/requantize_flatbuffer_utils.py index ef3d7ea3bb4..1f3954948e8 100644 --- a/tensorflow/lite/micro/tools/requantize_flatbuffer_utils.py +++ b/tensorflow/lite/micro/tools/requantize_flatbuffer_utils.py @@ -18,7 +18,7 @@ TensorType, ) -# Map flatbuffer tensor type code to numpy data type. see Table TensorType in tensorflow/lite/schema/schema.fbs +# Map flatbuffer tensor type code to numpy data type. see Table TensorType in tensorflow/lite/micro/schema/schema.fbs # TODO(b/269487423): use a common util function instead TENSOR_CODE_TYPE = { TensorType.FLOAT32: np.float32, diff --git a/tensorflow/lite/micro/tools/sync_schema.sh b/tensorflow/lite/micro/tools/sync_schema.sh index bdf2627ef5c..06a8f825e69 100755 --- a/tensorflow/lite/micro/tools/sync_schema.sh +++ b/tensorflow/lite/micro/tools/sync_schema.sh @@ -25,17 +25,17 @@ ROOT_DIR="${SCRIPT_DIR}/../../../.." cd "${ROOT_DIR}" SCHEMA_URL="https://raw.githubusercontent.com/google-ai-edge/LiteRT/main/tflite/converter/schema/schema.fbs" -TARGET_FBS="tensorflow/lite/schema/schema.fbs" +TARGET_FBS="tensorflow/lite/micro/schema/schema.fbs" echo "Downloading schema.fbs from ${SCHEMA_URL}..." curl -fsSL "${SCHEMA_URL}" -o "${TARGET_FBS}" echo "Generating C++ and Python FlatBuffers bindings..." -bazel build //tensorflow/lite/schema:schema_fbs_srcs //tensorflow/lite/micro/python:schema_py +bazel build //tensorflow/lite/micro/schema:schema_fbs_srcs //tensorflow/lite/micro/python:schema_py -if [ -f "bazel-bin/tensorflow/lite/schema/schema_generated.h" ]; then - cp -f bazel-bin/tensorflow/lite/schema/schema_generated.h tensorflow/lite/schema/schema_generated.h - echo "Updated tensorflow/lite/schema/schema_generated.h" +if [ -f "bazel-bin/tensorflow/lite/micro/schema/schema_generated.h" ]; then + cp -f bazel-bin/tensorflow/lite/micro/schema/schema_generated.h tensorflow/lite/micro/schema/schema_generated.h + echo "Updated tensorflow/lite/micro/schema/schema_generated.h" fi if [ -f "bazel-bin/tensorflow/lite/micro/python/schema_py_generated.py" ]; then diff --git a/tensorflow/lite/micro/tools/tflite_flatbuffer_align_wrapper.cc b/tensorflow/lite/micro/tools/tflite_flatbuffer_align_wrapper.cc index 152108b2087..6d858a4790e 100644 --- a/tensorflow/lite/micro/tools/tflite_flatbuffer_align_wrapper.cc +++ b/tensorflow/lite/micro/tools/tflite_flatbuffer_align_wrapper.cc @@ -17,7 +17,7 @@ limitations under the License. #include #include "flatbuffers/util.h" -#include "tensorflow/lite/schema/schema_generated.h" +#include "tensorflow/lite/micro/schema/schema_generated.h" namespace py = pybind11; diff --git a/third_party/xtensa/examples/micro_speech_lstm/micro_speech_lstm_test.cc b/third_party/xtensa/examples/micro_speech_lstm/micro_speech_lstm_test.cc index 3b55a283682..be3085e125c 100644 --- a/third_party/xtensa/examples/micro_speech_lstm/micro_speech_lstm_test.cc +++ b/third_party/xtensa/examples/micro_speech_lstm/micro_speech_lstm_test.cc @@ -39,7 +39,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/testing/micro_test_v2.h" -#include "tensorflow/lite/schema/schema_generated.h" #include "third_party/xtensa/examples/micro_speech_lstm/micro_speech_lstm_model_data.h" #include "third_party/xtensa/examples/micro_speech_lstm/no_micro_features_data.h" #include "third_party/xtensa/examples/micro_speech_lstm/yes_micro_features_data.h" diff --git a/third_party/xtensa/examples/pytorch_to_tflite/pytorch_to_tflite_test.cc b/third_party/xtensa/examples/pytorch_to_tflite/pytorch_to_tflite_test.cc index 41a55864060..80bc742223d 100644 --- a/third_party/xtensa/examples/pytorch_to_tflite/pytorch_to_tflite_test.cc +++ b/third_party/xtensa/examples/pytorch_to_tflite/pytorch_to_tflite_test.cc @@ -39,7 +39,6 @@ limitations under the License. #include "tensorflow/lite/micro/micro_log.h" #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" #include "tensorflow/lite/micro/testing/micro_test_v2.h" -#include "tensorflow/lite/schema/schema_generated.h" #include "third_party/xtensa/examples/pytorch_to_tflite/mobilenet_v2_quantized_1x3x224x224_model_data.h" #include "third_party/xtensa/examples/pytorch_to_tflite/pytorch_images_dog_jpg.h" #include "third_party/xtensa/examples/pytorch_to_tflite/pytorch_op_resolver.h"