Repository navigation
Commit 8f6596d
authored
Port signal custom ops to TensorFlow and TFLite C APIs (#3880)
* Port signal custom ops to TensorFlow C API and restore BUILD files
Vendor the 16 pure-C TensorFlow headers in third_party/tf_c_headers and port
all 9 signal custom ops and kernels from tensorflow/core/framework C++ headers
to tensorflow/c/{ops,kernels}.h. Restore the Bazel BUILD files and tflm_signal.bzl
so the signal custom-op shared library plugins build without downloading
TensorFlow at build time.
BUG=n/a
* Add TFLite C API kernels for signal custom ops
Vendor the 12 pure-C TFLite Opaque API headers in third_party/tflite_c_headers
and implement all 14 signal custom ops in signal/lite/kernels using
TfLiteOperator. Each op exposes Create*Operator() for LiteRT/C API callers and
Register_*() for TFLite MutableOpResolver callers, without requiring a TFLite
repo dependency at build time.
BUG=n/a
* Fix clang-tidy warnings in signal C API ops and kernels
- Move GetFlatSize and MakeRegistration to kernel_util.cc so compile_commands.json includes -Ithird_party/tflite_c_headers for kernel_util.h.
- Replace static lambda initializers in signal/tensorflow_core with __attribute__((constructor)) functions.
- Cast integer operands before multiplication and replace long long / signed bitwise shift.
BUG=n/a
* Simplify signal C API ops and kernels with C++ RAII wrappers
Wrap TensorFlow and TFLite C API handles, status propagation, and
registration callbacks in small C++ RAII helpers so ops and kernels read
like standard C++ classes without manual memory management.
BUG=n/a
* Add sync scripts and update READMEs for C API headers
Add sync.sh to third_party/tf_c_headers and third_party/tflite_c_headers
to fetch the pure-C headers verbatim from upstream TensorFlow (pinned to
v2.20.0 by default, or from a local checkout). Document how to run the
sync scripts in both README.md files.
BUG=n/a
* Add TFLite and LiteRT registration and tests for signal custom ops
* Consolidate signal build rules in py_rules.bzl and add tflm_oss_manual_tags
* Rename OpDefBuilder to SignalOpDefBuilder and document signal ops in Python
- Rename tflite::tflm_signal::OpDefBuilder to SignalOpDefBuilder in shape_inference_utils.h and clarify that it wraps TF_OpDefinitionBuilder* from tensorflow/c/ops.h (which has no .Doc() API).
- Replace detached REGISTER_OP doc blocks in signal/tensorflow_core/ops/*.cc with uniform registration comments pointing to the Python op modules.
- Replace internal _*_wrapper closures in python/tflite_micro/signal/ops/*.py with direct top-level functions and complete Google-style docstrings on all 14 public signal ops.
BUG=n/a1 parent f7ed40d commit 8f6596d
100 files changed
Lines changed: 15523 additions & 1485 deletions
File tree
- python
- tflite_micro/signal
- ops
- testdata
- utils
- signal
- lite
- kernels
- register
- tensorflow_core
- kernels
- ops
- tensorflow/lite/micro/tools/ci_build
- third_party
- tf_c_headers
- tensorflow
- core/platform
- c
- experimental/stream_executor
- tsl/platform
- xla/tsl/c
- tflite_c_headers
- tensorflow
- compiler/mlir/lite/core/c
- lite
- core
- async/c
- c
- c
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
28 | | - | |
29 | 32 | | |
30 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
31 | 53 | | |
32 | 54 | | |
33 | 55 | | |
| |||
75 | 97 | | |
76 | 98 | | |
77 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
0 commit comments