From ef1bc3dca7d05c22b1423a4f98dfa740ca7e7b3f Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 24 Jan 2026 20:26:23 -0800 Subject: [PATCH 1/6] Clean-up BUILD --- python/tflite_micro/BUILD | 11 ++--- python/tflite_micro/signal/BUILD | 28 ++++++------- python/tflite_micro/signal/utils/BUILD | 20 ++++----- tensorflow/lite/micro/build_def.bzl | 5 +++ tensorflow/lite/micro/compression/BUILD | 41 ++++--------------- .../lite/micro/compression/view_tests.bzl | 6 +-- .../lite/micro/examples/micro_speech/BUILD | 21 +++------- .../lite/micro/examples/mnist_lstm/BUILD | 6 +-- tensorflow/lite/micro/examples/recipes/BUILD | 6 +-- tensorflow/lite/micro/kernels/BUILD | 7 ++++ .../lite/micro/python/tflite_size/tests/BUILD | 6 +-- tensorflow/lite/micro/tools/BUILD | 39 +++++------------- 12 files changed, 68 insertions(+), 128 deletions(-) diff --git a/python/tflite_micro/BUILD b/python/tflite_micro/BUILD index 5932c5c75d6..a811a711d2e 100644 --- a/python/tflite_micro/BUILD +++ b/python/tflite_micro/BUILD @@ -14,6 +14,7 @@ load( "tflm_cc_library", ) load("//tools:expand_stamp_vars.bzl", "expand_stamp_vars") +load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") package( features = ["-layering_check"], @@ -91,10 +92,7 @@ py_test( "nomsan", # Python doesn't like these symbols in _runtime.so "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":runtime", requirement("numpy"), @@ -311,8 +309,5 @@ sh_test( "notap", # See http://b/294278650#comment4 for more details. "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) diff --git a/python/tflite_micro/signal/BUILD b/python/tflite_micro/signal/BUILD index b98ac0da7b6..335bf10a629 100644 --- a/python/tflite_micro/signal/BUILD +++ b/python/tflite_micro/signal/BUILD @@ -3,6 +3,7 @@ load("@rules_python//python:defs.bzl", "py_library", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") load("//python/tflite_micro/signal:tflm_signal.bzl", "py_tflm_signal_library") load("//tensorflow:extra_rules.bzl", "tflm_signal_friends") +load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") package( default_visibility = [":__subpackages__"], @@ -14,14 +15,9 @@ package_group( packages = tflm_signal_friends(), ) -TARGET_COMPATIBLE_WITH = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], -}) - cc_library( name = "ops_lib", - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, visibility = [":signal_friends"], deps = [ ":delay_op_cc", @@ -42,7 +38,7 @@ py_library( "__init__.py", "ops/__init__.py", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, visibility = ["//visibility:public"], deps = [ ":delay_op", @@ -78,7 +74,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":delay_op", requirement("numpy"), @@ -110,7 +106,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":energy_op", requirement("numpy"), @@ -142,7 +138,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":fft_ops", requirement("numpy"), @@ -180,7 +176,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":filter_bank_ops", requirement("numpy"), @@ -212,7 +208,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":framer_op", requirement("numpy"), @@ -241,7 +237,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":overlap_add_op", requirement("absl_py"), @@ -274,7 +270,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":pcan_op", requirement("numpy"), @@ -306,7 +302,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":stacker_op", requirement("numpy"), @@ -337,7 +333,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":window_op", requirement("numpy"), diff --git a/python/tflite_micro/signal/utils/BUILD b/python/tflite_micro/signal/utils/BUILD index 024b9859dd8..b047dd6a316 100644 --- a/python/tflite_micro/signal/utils/BUILD +++ b/python/tflite_micro/signal/utils/BUILD @@ -3,6 +3,7 @@ load("@pybind11_bazel//:build_defs.bzl", "pybind_extension") # Signal python utilities. load("@rules_python//python:defs.bzl", "py_library", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") +load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") package( default_visibility = [ @@ -11,11 +12,6 @@ package( licenses = ["notice"], ) -TARGET_COMPATIBLE_WITH = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], -}) - py_test( name = "freq_to_mel_test", srcs = ["freq_to_mel_test.py"], @@ -27,7 +23,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) py_library( @@ -35,7 +31,7 @@ py_library( data = [ ":freq_to_mel_wrapper.so", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) pybind_extension( @@ -43,13 +39,13 @@ pybind_extension( srcs = [ "freq_to_mel_wrapper.cc", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) py_library( name = "util", srcs = ["util.py"], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, visibility = ["//visibility:public"], deps = [ requirement("tensorflow"), @@ -62,7 +58,7 @@ pybind_extension( srcs = [ "wide_dynamic_func_lut_wrapper.cc", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) py_library( @@ -70,7 +66,7 @@ py_library( data = [ ":wide_dynamic_func_lut_wrapper.so", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) py_test( @@ -84,6 +80,6 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = TARGET_COMPATIBLE_WITH, + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, visibility = ["//visibility:public"], ) diff --git a/tensorflow/lite/micro/build_def.bzl b/tensorflow/lite/micro/build_def.bzl index 2a5006107fc..4d95362a87b 100644 --- a/tensorflow/lite/micro/build_def.bzl +++ b/tensorflow/lite/micro/build_def.bzl @@ -4,6 +4,11 @@ load("@rules_cc//cc:cc_binary.bzl", "cc_binary") load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_cc//cc:cc_test.bzl", "cc_test") +INCOMPATIBLE_WITH_WINDOWS = select({ + "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], + "//conditions:default": [], +}) + def tflm_copts(): """Returns the default copts for targets in TFLM. diff --git a/tensorflow/lite/micro/compression/BUILD b/tensorflow/lite/micro/compression/BUILD index a3b009abdee..146e60a2315 100644 --- a/tensorflow/lite/micro/compression/BUILD +++ b/tensorflow/lite/micro/compression/BUILD @@ -8,6 +8,7 @@ load("@rules_shell//shell:sh_test.bzl", "sh_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") load( "//tensorflow/lite/micro:build_def.bzl", + "INCOMPATIBLE_WITH_WINDOWS", "tflm_cc_library", "tflm_cc_test", ) @@ -75,10 +76,7 @@ sh_test( "metadata_saved.h", ":metadata_cc_srcs", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -105,10 +103,7 @@ py_test( size = "small", srcs = ["metadata_test.py"], main = "metadata_test.py", - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ "metadata_py", "@flatbuffers//:runtime_py", @@ -154,10 +149,7 @@ py_test( "nomsan", # Sanitizer symbols don't work with Python extension libs "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":compress", ":metadata_py", @@ -184,10 +176,7 @@ py_test( name = "model_facade_test", size = "small", srcs = ["model_facade_test.py"], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":model_facade", ":test_models", @@ -207,10 +196,7 @@ py_test( name = "spec_test", size = "small", srcs = ["spec_test.py"], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":spec", requirement("tensorflow"), @@ -229,10 +215,7 @@ py_test( name = "spec_builder_test", size = "small", srcs = ["spec_builder_test.py"], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":spec", ":spec_builder", @@ -254,10 +237,7 @@ py_test( name = "test_models_test", size = "small", srcs = ["test_models_test.py"], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":test_models", "//tensorflow/lite/python:schema_py", @@ -270,10 +250,7 @@ py_binary( srcs = [ "view.py", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":metadata_py", "//tensorflow/lite/python:schema_py", diff --git a/tensorflow/lite/micro/compression/view_tests.bzl b/tensorflow/lite/micro/compression/view_tests.bzl index 43011ddf602..c9b54232cfb 100644 --- a/tensorflow/lite/micro/compression/view_tests.bzl +++ b/tensorflow/lite/micro/compression/view_tests.bzl @@ -1,5 +1,6 @@ load("@rules_python//python:defs.bzl", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") +load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") def generate_view_tests(targets): """Generates py_test targets for each target's path and a test_suite to @@ -19,10 +20,7 @@ def generate_view_tests(targets): args = ["$(location {})".format(target)], main = "view_test.py", data = [target], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":view", requirement("absl_py"), diff --git a/tensorflow/lite/micro/examples/micro_speech/BUILD b/tensorflow/lite/micro/examples/micro_speech/BUILD index 216382230d4..7b2eddb90a0 100644 --- a/tensorflow/lite/micro/examples/micro_speech/BUILD +++ b/tensorflow/lite/micro/examples/micro_speech/BUILD @@ -4,6 +4,7 @@ load("@rules_python//python:defs.bzl", "py_binary", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") load( "//tensorflow/lite/micro:build_def.bzl", + "INCOMPATIBLE_WITH_WINDOWS", "generate_cc_arrays", "tflm_cc_library", "tflm_cc_test", @@ -207,10 +208,7 @@ py_binary( data = [ ":samples_30ms", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ requirement("absl_py"), requirement("numpy"), @@ -227,10 +225,7 @@ py_binary( data = [ ":models_tflite", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":audio_preprocessor", ], @@ -249,10 +244,7 @@ py_test( "nomsan", # Python doesn't like these symbols "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":evaluate", ], @@ -271,10 +263,7 @@ py_test( "nomsan", # Python doesn't like these symbols "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":audio_preprocessor", ], diff --git a/tensorflow/lite/micro/examples/mnist_lstm/BUILD b/tensorflow/lite/micro/examples/mnist_lstm/BUILD index ec846f91f8c..d93362bb3ae 100644 --- a/tensorflow/lite/micro/examples/mnist_lstm/BUILD +++ b/tensorflow/lite/micro/examples/mnist_lstm/BUILD @@ -1,5 +1,6 @@ load("@rules_python//python:defs.bzl", "py_binary", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") +load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") py_binary( name = "train", @@ -39,10 +40,7 @@ py_test( "nomsan", # Python doesn't like these symbols "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":evaluate", ":train", diff --git a/tensorflow/lite/micro/examples/recipes/BUILD b/tensorflow/lite/micro/examples/recipes/BUILD index b3e880fb77b..5827e73dd47 100644 --- a/tensorflow/lite/micro/examples/recipes/BUILD +++ b/tensorflow/lite/micro/examples/recipes/BUILD @@ -1,5 +1,6 @@ load("@rules_python//python:defs.bzl", "py_library", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") +load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") package( licenses = ["notice"], @@ -33,10 +34,7 @@ py_test( "nomsan", # Python doesn't like these symbols "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":resource_variables_lib", "//python/tflite_micro:runtime", diff --git a/tensorflow/lite/micro/kernels/BUILD b/tensorflow/lite/micro/kernels/BUILD index 8a92b652410..666e0bff3e2 100644 --- a/tensorflow/lite/micro/kernels/BUILD +++ b/tensorflow/lite/micro/kernels/BUILD @@ -10,6 +10,7 @@ load( ) load( "//tensorflow/lite/micro:build_def.bzl", + "INCOMPATIBLE_WITH_WINDOWS", "tflm_cc_library", "tflm_cc_test", "tflm_copts", @@ -544,6 +545,7 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -562,6 +564,7 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -920,6 +923,7 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -938,6 +942,7 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -1152,6 +1157,7 @@ tflm_cc_test( "//tensorflow/lite/micro:debug_log", "//tensorflow/lite/micro/testing:micro_test", ], + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -1610,6 +1616,7 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( diff --git a/tensorflow/lite/micro/python/tflite_size/tests/BUILD b/tensorflow/lite/micro/python/tflite_size/tests/BUILD index d34f8ea54e4..06ed25d4ced 100644 --- a/tensorflow/lite/micro/python/tflite_size/tests/BUILD +++ b/tensorflow/lite/micro/python/tflite_size/tests/BUILD @@ -1,5 +1,6 @@ load("@rules_python//python:defs.bzl", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") +load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") licenses(["notice"]) @@ -24,10 +25,7 @@ py_test( "nomsan", # Python doesn't like these symbols from flatbuffer_size_wrapper_pybind.so "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ requirement("tensorflow"), "//tensorflow/lite/micro/python/tflite_size/src:flatbuffer_size", diff --git a/tensorflow/lite/micro/tools/BUILD b/tensorflow/lite/micro/tools/BUILD index 364261b1e90..70cba2eb746 100644 --- a/tensorflow/lite/micro/tools/BUILD +++ b/tensorflow/lite/micro/tools/BUILD @@ -1,3 +1,7 @@ +load( + "//tensorflow/lite/micro:build_def.bzl", + "INCOMPATIBLE_WITH_WINDOWS", +) load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library") load("@pybind11_bazel//:build_defs.bzl", "pybind_extension") load("@rules_cc//cc:cc_binary.bzl", "cc_binary") @@ -69,10 +73,7 @@ py_test( "nomsan", # Python doesn't like these symbols "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":requantize_flatbuffer", requirement("numpy"), @@ -86,10 +87,7 @@ pybind_extension( srcs = [ "tflite_flatbuffer_align_wrapper.cc", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ "//tensorflow/lite/schema:schema_fbs", "@flatbuffers", @@ -104,10 +102,7 @@ py_binary( data = [ ":tflite_flatbuffer_align_wrapper.so", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ requirement("absl_py"), ], @@ -119,10 +114,7 @@ py_library( data = [ ":tflite_flatbuffer_align_wrapper.so", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, visibility = [ ":application_friends", ":tflm_tools", @@ -139,10 +131,7 @@ py_library( data = [ ":tflite_flatbuffer_align", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, visibility = [ ":application_friends", ":tflm_tools", @@ -183,10 +172,7 @@ cc_binary( py_binary( name = "tflm_model_transforms", srcs = ["tflm_model_transforms.py"], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":tflm_model_transforms_lib", requirement("absl_py"), @@ -205,10 +191,7 @@ py_test( "nomsan", "noubsan", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":tflm_model_transforms_lib", requirement("absl_py"), From 259017361df32eecf0c61cb12fc2f01ab82036ca Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 24 Jan 2026 20:26:36 -0800 Subject: [PATCH 2/6] Added pyproject.toml --- pyproject.toml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000000..e02e0b56586 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +[tool.black] +line-length = 80 +skip-string-normalization = true +target-version = ['py310'] + +[tool.isort] +profile = "google" +line_length = 80 + +[tool.pylint.messages_control] +disable = [ + "C0330", # Bad indentation (handled by Black) + "C0326", # Bad whitespace (handled by Black) +] + +[tool.pylint.format] +max-line-length = 80 From 6d7ee8d04600065737c84e23b5cf9b6a74c0a43b Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 24 Jan 2026 20:40:23 -0800 Subject: [PATCH 3/6] Format gen --- .../lite/micro/tools/generate_cc_arrays.py | 295 +++++++++--------- 1 file changed, 155 insertions(+), 140 deletions(-) diff --git a/tensorflow/lite/micro/tools/generate_cc_arrays.py b/tensorflow/lite/micro/tools/generate_cc_arrays.py index eb10d2ddec7..84e9f7d0d61 100644 --- a/tensorflow/lite/micro/tools/generate_cc_arrays.py +++ b/tensorflow/lite/micro/tools/generate_cc_arrays.py @@ -22,163 +22,178 @@ import os import struct import wave -import numpy as np +import numpy as np from PIL import Image def generate_file(out_fname, array_name, array_type, array_contents, size): - """Write an array of values to a CC or header file.""" - os.makedirs(os.path.dirname(out_fname), exist_ok=True) - if out_fname.endswith(".cc"): - with open(out_fname, "w") as out_cc_file: - out_cc_file.write("#include \n\n") - # Header include path logic, maintaining compatibility with genfiles/ structure. - header_path = out_fname.split("genfiles/")[-1].replace(".cc", ".h") - out_cc_file.write('#include "{}"\n\n'.format(header_path)) - out_cc_file.write( - "alignas(16) const {} {}[] = {{".format(array_type, array_name) - ) - out_cc_file.write(array_contents) - out_cc_file.write("};\n") - elif out_fname.endswith(".h"): - with open(out_fname, "w") as out_hdr_file: - out_hdr_file.write("#include \n\n") - out_hdr_file.write( - "constexpr unsigned int {}_size = {};\n".format(array_name, str(size)) - ) - out_hdr_file.write("extern const {} {}[];\n".format(array_type, array_name)) - else: - raise ValueError("generated file must be end with .cc or .h") + """Write an array of values to a CC or header file.""" + os.makedirs(os.path.dirname(out_fname), exist_ok=True) + if out_fname.endswith(".cc"): + with open(out_fname, "w") as out_cc_file: + out_cc_file.write("#include \n\n") + # Header include path logic, maintaining compatibility with genfiles/ structure. + header_path = out_fname.split("genfiles/")[-1].replace(".cc", ".h") + out_cc_file.write('#include "{}"\n\n'.format(header_path)) + out_cc_file.write( + "alignas(16) const {} {}[] = {{".format(array_type, array_name) + ) + out_cc_file.write(array_contents) + out_cc_file.write("};\n") + elif out_fname.endswith(".h"): + with open(out_fname, "w") as out_hdr_file: + out_hdr_file.write("#include \n\n") + out_hdr_file.write( + "constexpr unsigned int {}_size = {};\n".format(array_name, str(size)) + ) + out_hdr_file.write( + "extern const {} {}[];\n".format(array_type, array_name) + ) + else: + raise ValueError("generated file must be end with .cc or .h") def bytes_to_hexstring(buffer): - """Convert a byte array to a hex string.""" - return ",".join([hex(b) for b in buffer]) + """Convert a byte array to a hex string.""" + return ",".join([hex(b) for b in buffer]) def generate_array(input_fname): - """Return array size and array of data from the input file.""" - if input_fname.endswith(".tflite"): - with open(input_fname, "rb") as input_file: - buffer = input_file.read() - size = len(buffer) - out_string = bytes_to_hexstring(buffer) - return [size, out_string] - elif input_fname.endswith(".bmp"): - img = Image.open(input_fname, mode="r") - image_bytes = img.tobytes() - size = len(image_bytes) - out_string = bytes_to_hexstring(image_bytes) - return [size, out_string] - elif input_fname.endswith(".wav"): - wav_file = wave.open(input_fname, mode="r") - num_channels = wav_file.getnchannels() - n_frames = wav_file.getnframes() - frames = wav_file.readframes(n_frames) - samples = struct.unpack("<%dh" % (num_channels * n_frames), frames) - out_string = ",".join(map(str, samples)) - wav_file.close() - return [wav_file.getnframes(), out_string] - elif input_fname.endswith(".csv"): - with open(input_fname, "r") as input_file: - # Assume one array per csv file. - elements = input_file.readline() - return [len(elements.split(",")), elements] - elif input_fname.endswith(".npy"): - data = np.float32(np.load(input_fname, allow_pickle=False)) - data_1d = data.flatten() - out_string = ",".join([str(x) for x in data_1d]) - return [len(data_1d), out_string] - else: - raise ValueError("input file must be .tflite, .bmp, .wav or .csv") + """Return array size and array of data from the input file.""" + if input_fname.endswith(".tflite"): + with open(input_fname, "rb") as input_file: + buffer = input_file.read() + size = len(buffer) + out_string = bytes_to_hexstring(buffer) + return [size, out_string] + elif input_fname.endswith(".bmp"): + img = Image.open(input_fname, mode="r") + image_bytes = img.tobytes() + size = len(image_bytes) + out_string = bytes_to_hexstring(image_bytes) + return [size, out_string] + elif input_fname.endswith(".wav"): + wav_file = wave.open(input_fname, mode="r") + num_channels = wav_file.getnchannels() + n_frames = wav_file.getnframes() + frames = wav_file.readframes(n_frames) + samples = struct.unpack("<%dh" % (num_channels * n_frames), frames) + out_string = ",".join(map(str, samples)) + wav_file.close() + return [wav_file.getnframes(), out_string] + elif input_fname.endswith(".csv"): + with open(input_fname, "r") as input_file: + # Assume one array per csv file. + elements = input_file.readline() + return [len(elements.split(",")), elements] + elif input_fname.endswith(".npy"): + data = np.float32(np.load(input_fname, allow_pickle=False)) + data_1d = data.flatten() + out_string = ",".join([str(x) for x in data_1d]) + return [len(data_1d), out_string] + else: + raise ValueError("input file must be .tflite, .bmp, .wav or .csv") def get_array_name_and_type(input_fname): - """Return the array name and type for a given input file.""" - # Use os.path.basename to correctly handle both Unix and Windows paths. - base_fname = os.path.basename(input_fname) - # Original logic extracted the filename part between the last two dots. - name_parts = base_fname.split(".") - name_no_ext = name_parts[-2] if len(name_parts) >= 2 else base_fname - base_array_name = "g_" + name_no_ext - - if input_fname.endswith(".tflite"): - return [base_array_name + "_model_data", "unsigned char"] - elif input_fname.endswith(".bmp"): - return [base_array_name + "_image_data", "unsigned char"] - elif input_fname.endswith(".wav"): - return [base_array_name + "_audio_data", "int16_t"] - elif input_fname.endswith( - ("_int32.csv", "_int16.csv", "_int8.csv", "_float.csv", ".csv", ".npy") - ): - return [ - base_array_name + "_test_data", - ( - "int32_t" - if "_int32.csv" in input_fname - else ( - "int16_t" - if "_int16.csv" in input_fname - else "int8_t" if "_int8.csv" in input_fname else "float" - ) - ), - ] - else: - return [base_array_name + "_data", "unsigned char"] + """Return the array name and type for a given input file.""" + # Use os.path.basename to correctly handle both Unix and Windows paths. + base_fname = os.path.basename(input_fname) + # Original logic extracted the filename part between the last two dots. + name_parts = base_fname.split(".") + name_no_ext = name_parts[-2] if len(name_parts) >= 2 else base_fname + base_array_name = "g_" + name_no_ext + + if input_fname.endswith(".tflite"): + return [base_array_name + "_model_data", "unsigned char"] + elif input_fname.endswith(".bmp"): + return [base_array_name + "_image_data", "unsigned char"] + elif input_fname.endswith(".wav"): + return [base_array_name + "_audio_data", "int16_t"] + elif input_fname.endswith( + ("_int32.csv", "_int16.csv", "_int8.csv", "_float.csv", ".csv", ".npy") + ): + return [ + base_array_name + "_test_data", + ( + "int32_t" + if "_int32.csv" in input_fname + else ( + "int16_t" + if "_int16.csv" in input_fname + else "int8_t" + if "_int8.csv" in input_fname + else "float" + ) + ), + ] + else: + return [base_array_name + "_data", "unsigned char"] def main(): - """Create cc sources with c arrays with data from each .tflite or .bmp.""" - parser = argparse.ArgumentParser() - parser.add_argument( - "output", help="base directory for all outputs or a cc or header to generate." - ) - parser.add_argument( - "inputs", - nargs="+", - help="input wav, bmp or tflite files to convert. " - "If output is a cc or header only one input may be specified.", - ) - args = parser.parse_args() - - if args.output.endswith(".cc") or args.output.endswith(".h"): - assert len(args.inputs) == 1 - size, cc_array = generate_array(args.inputs[0]) - generated_array_name, array_type = get_array_name_and_type(args.inputs[0]) - generate_file(args.output, generated_array_name, array_type, cc_array, size) - else: - # Deduplicate inputs to prevent duplicate generated files (ODR issue). - for input_file in list(dict.fromkeys(args.inputs)): - output_base_fname = os.path.join( - args.output, os.path.splitext(input_file)[0] - ) - if input_file.endswith(".tflite"): - output_base_fname += "_model_data" - elif input_file.endswith(".bmp"): - output_base_fname += "_image_data" - elif input_file.endswith(".wav"): - output_base_fname += "_audio_data" - elif input_file.endswith((".csv", ".npy")): - output_base_fname += "_test_data" - else: - raise ValueError( - "input file must be .tflite, .bmp, .wav , .npy or .csv" - ) - - output_cc_fname = output_base_fname + ".cc" - # Print output cc filename for Make to include it in the build. - print(output_cc_fname) - output_hdr_fname = output_base_fname + ".h" - size, cc_array = generate_array(input_file) - generated_array_name, array_type = get_array_name_and_type(input_file) - generate_file( - output_cc_fname, generated_array_name, array_type, cc_array, size - ) - generate_file( - output_hdr_fname, generated_array_name, array_type, cc_array, size - ) + """Create cc sources with c arrays with data from each .tflite or .bmp.""" + parser = argparse.ArgumentParser() + parser.add_argument( + "output", + help="base directory for all outputs or a cc or header to generate.", + ) + parser.add_argument( + "inputs", + nargs="+", + help=( + "input wav, bmp or tflite files to convert. " + "If output is a cc or header only one input may be specified." + ), + ) + args = parser.parse_args() + + if args.output.endswith(".cc") or args.output.endswith(".h"): + assert len(args.inputs) == 1 + size, cc_array = generate_array(args.inputs[0]) + generated_array_name, array_type = get_array_name_and_type(args.inputs[0]) + generate_file(args.output, generated_array_name, array_type, cc_array, size) + else: + # Deduplicate inputs to prevent duplicate generated files (ODR issue). + for input_file in list(dict.fromkeys(args.inputs)): + output_base_fname = os.path.join( + args.output, os.path.splitext(input_file)[0] + ) + if input_file.endswith(".tflite"): + output_base_fname += "_model_data" + elif input_file.endswith(".bmp"): + output_base_fname += "_image_data" + elif input_file.endswith(".wav"): + output_base_fname += "_audio_data" + elif input_file.endswith((".csv", ".npy")): + output_base_fname += "_test_data" + else: + raise ValueError( + "input file must be .tflite, .bmp, .wav , .npy or .csv" + ) + + output_cc_fname = output_base_fname + ".cc" + # Print output cc filename for Make to include it in the build. + print(output_cc_fname) + output_hdr_fname = output_base_fname + ".h" + size, cc_array = generate_array(input_file) + generated_array_name, array_type = get_array_name_and_type(input_file) + generate_file( + output_cc_fname, + generated_array_name, + array_type, + cc_array, + size, + ) + generate_file( + output_hdr_fname, + generated_array_name, + array_type, + cc_array, + size, + ) if __name__ == "__main__": - main() + main() From 00f432de91074a4e7786e3f96c44294ac3a20a3b Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 24 Jan 2026 20:46:49 -0800 Subject: [PATCH 4/6] Fix --- python/tflite_micro/BUILD | 2 +- tensorflow/lite/micro/kernels/BUILD | 36 +++++------------------------ tensorflow/lite/micro/tools/BUILD | 8 +++---- 3 files changed, 11 insertions(+), 35 deletions(-) diff --git a/python/tflite_micro/BUILD b/python/tflite_micro/BUILD index a811a711d2e..d6faa8a0a9a 100644 --- a/python/tflite_micro/BUILD +++ b/python/tflite_micro/BUILD @@ -11,10 +11,10 @@ load( ) load( "//tensorflow/lite/micro:build_def.bzl", + "INCOMPATIBLE_WITH_WINDOWS", "tflm_cc_library", ) load("//tools:expand_stamp_vars.bzl", "expand_stamp_vars") -load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS") package( features = ["-layering_check"], diff --git a/tensorflow/lite/micro/kernels/BUILD b/tensorflow/lite/micro/kernels/BUILD index 666e0bff3e2..ca1ee3bde94 100644 --- a/tensorflow/lite/micro/kernels/BUILD +++ b/tensorflow/lite/micro/kernels/BUILD @@ -534,10 +534,7 @@ tflm_cc_test( srcs = [ "broadcast_args_test.cc", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":kernel_runner", "//tensorflow/lite/c:common", @@ -545,7 +542,6 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], - target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -553,10 +549,7 @@ tflm_cc_test( srcs = [ "broadcast_to_test.cc", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":kernel_runner", "//tensorflow/lite/c:common", @@ -564,7 +557,6 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], - target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -911,10 +903,7 @@ tflm_cc_test( tflm_cc_test( name = "expand_dims_test", srcs = ["expand_dims_test.cc"], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":kernel_runner", "//tensorflow/lite/c:common", @@ -923,7 +912,6 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], - target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -931,10 +919,7 @@ tflm_cc_test( srcs = [ "fill_test.cc", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":kernel_runner", "//tensorflow/lite/c:common", @@ -942,7 +927,6 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], - target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -1148,16 +1132,12 @@ tflm_cc_test( srcs = [ "lstm_eval_test.cc", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":lstm_eval_test_lib", "//tensorflow/lite/micro:debug_log", "//tensorflow/lite/micro/testing:micro_test", ], - target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( @@ -1602,10 +1582,7 @@ tflm_cc_test( srcs = [ "unidirectional_sequence_lstm_test.cc", ], - target_compatible_with = select({ - "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], - "//conditions:default": [], - }), + target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, deps = [ ":kernel_runner", ":lstm_eval_test_lib", @@ -1616,7 +1593,6 @@ tflm_cc_test( "//tensorflow/lite/micro:test_helpers", "//tensorflow/lite/micro/testing:micro_test", ], - target_compatible_with = INCOMPATIBLE_WITH_WINDOWS, ) tflm_cc_test( diff --git a/tensorflow/lite/micro/tools/BUILD b/tensorflow/lite/micro/tools/BUILD index 70cba2eb746..2c513e85a4e 100644 --- a/tensorflow/lite/micro/tools/BUILD +++ b/tensorflow/lite/micro/tools/BUILD @@ -1,13 +1,13 @@ -load( - "//tensorflow/lite/micro:build_def.bzl", - "INCOMPATIBLE_WITH_WINDOWS", -) load("@flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library") load("@pybind11_bazel//:build_defs.bzl", "pybind_extension") load("@rules_cc//cc:cc_binary.bzl", "cc_binary") load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") load("@tflm_pip_deps//:requirements.bzl", "requirement") load("//tensorflow:extra_rules.bzl", "tflm_application_friends") +load( + "//tensorflow/lite/micro:build_def.bzl", + "INCOMPATIBLE_WITH_WINDOWS", +) package( default_visibility = ["//:__subpackages__"], From bf6a614dffcfd37d76faf563adbf321bb0bbecb0 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 24 Jan 2026 20:56:13 -0800 Subject: [PATCH 5/6] Fix format --- pyproject.toml | 17 ------- .../lite/micro/tools/generate_cc_arrays.py | 46 ++++++------------- 2 files changed, 15 insertions(+), 48 deletions(-) delete mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index e02e0b56586..00000000000 --- a/pyproject.toml +++ /dev/null @@ -1,17 +0,0 @@ -[tool.black] -line-length = 80 -skip-string-normalization = true -target-version = ['py310'] - -[tool.isort] -profile = "google" -line_length = 80 - -[tool.pylint.messages_control] -disable = [ - "C0330", # Bad indentation (handled by Black) - "C0326", # Bad whitespace (handled by Black) -] - -[tool.pylint.format] -max-line-length = 80 diff --git a/tensorflow/lite/micro/tools/generate_cc_arrays.py b/tensorflow/lite/micro/tools/generate_cc_arrays.py index 84e9f7d0d61..a3ac8d605f5 100644 --- a/tensorflow/lite/micro/tools/generate_cc_arrays.py +++ b/tensorflow/lite/micro/tools/generate_cc_arrays.py @@ -36,20 +36,17 @@ def generate_file(out_fname, array_name, array_type, array_contents, size): # Header include path logic, maintaining compatibility with genfiles/ structure. header_path = out_fname.split("genfiles/")[-1].replace(".cc", ".h") out_cc_file.write('#include "{}"\n\n'.format(header_path)) - out_cc_file.write( - "alignas(16) const {} {}[] = {{".format(array_type, array_name) - ) + out_cc_file.write("alignas(16) const {} {}[] = {{".format( + array_type, array_name)) out_cc_file.write(array_contents) out_cc_file.write("};\n") elif out_fname.endswith(".h"): with open(out_fname, "w") as out_hdr_file: out_hdr_file.write("#include \n\n") - out_hdr_file.write( - "constexpr unsigned int {}_size = {};\n".format(array_name, str(size)) - ) - out_hdr_file.write( - "extern const {} {}[];\n".format(array_type, array_name) - ) + out_hdr_file.write("constexpr unsigned int {}_size = {};\n".format( + array_name, str(size))) + out_hdr_file.write("extern const {} {}[];\n".format( + array_type, array_name)) else: raise ValueError("generated file must be end with .cc or .h") @@ -112,21 +109,12 @@ def get_array_name_and_type(input_fname): elif input_fname.endswith(".wav"): return [base_array_name + "_audio_data", "int16_t"] elif input_fname.endswith( - ("_int32.csv", "_int16.csv", "_int8.csv", "_float.csv", ".csv", ".npy") - ): + ("_int32.csv", "_int16.csv", "_int8.csv", "_float.csv", ".csv", ".npy")): return [ base_array_name + "_test_data", - ( - "int32_t" - if "_int32.csv" in input_fname - else ( - "int16_t" - if "_int16.csv" in input_fname - else "int8_t" - if "_int8.csv" in input_fname - else "float" - ) - ), + ("int32_t" if "_int32.csv" in input_fname else + ("int16_t" if "_int16.csv" in input_fname else + "int8_t" if "_int8.csv" in input_fname else "float")), ] else: return [base_array_name + "_data", "unsigned char"] @@ -142,10 +130,8 @@ def main(): parser.add_argument( "inputs", nargs="+", - help=( - "input wav, bmp or tflite files to convert. " - "If output is a cc or header only one input may be specified." - ), + help=("input wav, bmp or tflite files to convert. " + "If output is a cc or header only one input may be specified."), ) args = parser.parse_args() @@ -157,9 +143,8 @@ def main(): else: # Deduplicate inputs to prevent duplicate generated files (ODR issue). for input_file in list(dict.fromkeys(args.inputs)): - output_base_fname = os.path.join( - args.output, os.path.splitext(input_file)[0] - ) + output_base_fname = os.path.join(args.output, + os.path.splitext(input_file)[0]) if input_file.endswith(".tflite"): output_base_fname += "_model_data" elif input_file.endswith(".bmp"): @@ -170,8 +155,7 @@ def main(): output_base_fname += "_test_data" else: raise ValueError( - "input file must be .tflite, .bmp, .wav , .npy or .csv" - ) + "input file must be .tflite, .bmp, .wav , .npy or .csv") output_cc_fname = output_base_fname + ".cc" # Print output cc filename for Make to include it in the build. From 470687a24c66b62e8bd624e4a16a22d2172a3782 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 24 Jan 2026 21:03:56 -0800 Subject: [PATCH 6/6] Fix --- tensorflow/lite/micro/tools/generate_cc_arrays.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tensorflow/lite/micro/tools/generate_cc_arrays.py b/tensorflow/lite/micro/tools/generate_cc_arrays.py index a3ac8d605f5..84a12fc1cfc 100644 --- a/tensorflow/lite/micro/tools/generate_cc_arrays.py +++ b/tensorflow/lite/micro/tools/generate_cc_arrays.py @@ -139,7 +139,8 @@ def main(): assert len(args.inputs) == 1 size, cc_array = generate_array(args.inputs[0]) generated_array_name, array_type = get_array_name_and_type(args.inputs[0]) - generate_file(args.output, generated_array_name, array_type, cc_array, size) + generate_file(args.output, generated_array_name, array_type, cc_array, + size) else: # Deduplicate inputs to prevent duplicate generated files (ODR issue). for input_file in list(dict.fromkeys(args.inputs)):