Skip to content

Commit f50d917

Browse files
gonnetveblush
andauthored
Switch to LiteRT repo (#3199)
* Switch from the github.com/tensorflow/tensorflow repository to the new github.com/google-ai-edge/LiteRT repository for TFLite sources. * Fix up include paths. * More fixes. * Fix more paths. * Re-add missing python fixes. * Re-add missing python fixes. * Re-run `bazel run //third_party:python_requirements.update -- --upgrade` with Python 3.12. * Revert third_party/python_requirements.txt. --------- Co-authored-by: Esun Kim <[email protected]>
1 parent 4186e7d commit f50d917

File tree

7 files changed

+149
-136
lines changed

7 files changed

+149
-136
lines changed

ci/sync_from_upstream_tf.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,33 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2727
ROOT_DIR=${SCRIPT_DIR}/..
2828
cd "${ROOT_DIR}"
2929

30-
rm -rf /tmp/tensorflow
30+
rm -rf /tmp/litert
3131

32-
git clone https://github.com/tensorflow/tensorflow.git --depth=1 /tmp/tensorflow
32+
git clone https://github.com/google-ai-edge/LiteRT.git --depth=1 /tmp/litert
3333

34-
SHARED_TFL_CODE=$(<ci/tflite_files.txt)
34+
SHARED_TFL_CODE=$(grep -v tflite/converter ci/tflite_files.txt)
35+
SHARED_CONVERTER_CODE=$(grep tflite/converter ci/tflite_files.txt)
3536

3637
# Delete all the shared TFL/TFLM code prior to copying from upstream to ensure
3738
# no stale files are left in the tree.
3839
rm -f $(find tensorflow/lite/ -type d \( -path tensorflow/lite/experimental -o -path tensorflow/lite/micro \) -prune -false -o -name "*.cc" -o -name "*.c" -o -name "*.h" -o -name "*.py" -o -name "*.fbs")
3940

41+
# Copy all the right files from the TFLite repo to all the right places in this repo.
4042
for filepath in ${SHARED_TFL_CODE}
4143
do
42-
mkdir -p $(dirname ${filepath})
43-
/bin/cp /tmp/tensorflow/${filepath} ${filepath}
44+
local_filepath=${filepath//tflite\//tensorflow\/lite\/}
45+
mkdir -p $(dirname ${local_filepath})
46+
/bin/cp /tmp/litert/${filepath} ${local_filepath}
47+
sed -i 's/tflite\/converter\//tensorflow\/compiler\/mlir\/lite\//' ${local_filepath}
48+
sed -i 's/tflite\//tensorflow\/lite\//' ${local_filepath}
49+
done
50+
for filepath in ${SHARED_CONVERTER_CODE}
51+
do
52+
local_filepath=${filepath//tflite\/converter\//tensorflow\/compiler\/mlir\/lite\/}
53+
mkdir -p $(dirname ${local_filepath})
54+
/bin/cp /tmp/litert/${filepath} ${local_filepath}
55+
sed -i 's/tflite\/converter\//tensorflow\/compiler\/mlir\/lite\//' ${local_filepath}
56+
sed -i 's/tflite\//tensorflow\/lite\//' ${local_filepath}
4457
done
4558

4659
# https://github.com/tensorflow/tflite-micro/pull/8
@@ -68,7 +81,7 @@ bazel clean
6881
# repositories (TF and tflite-micro) which needs the import statements to be
6982
# modified.
7083
PY_FILES=$(find tensorflow/lite/tools tensorflow/lite/python -name "*.py")
71-
sed -i 's/from tensorflow\.lite/from tflite_micro\.tensorflow\.lite/' ${PY_FILES}
84+
sed -i 's/from tflite/from tflite_micro\.tensorflow\.lite/' ${PY_FILES}
7285

7386
# Since the TFLM code was deleted from the tensorflow repository, the
7487
# microfrontend is no longer sync'd from upstream and instead maintaned as a

ci/tflite_files.txt

Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,123 @@
1-
tensorflow/compiler/mlir/lite/core/api/error_reporter.h
2-
tensorflow/compiler/mlir/lite/core/api/error_reporter.cc
3-
tensorflow/compiler/mlir/lite/core/c/builtin_op_data.h
4-
tensorflow/compiler/mlir/lite/core/c/tflite_types.h
5-
tensorflow/compiler/mlir/lite/schema/schema.fbs
6-
tensorflow/compiler/mlir/lite/schema/schema_utils.h
7-
tensorflow/compiler/mlir/lite/schema/schema_utils.cc
8-
tensorflow/lite/array.h
9-
tensorflow/lite/array.cc
10-
tensorflow/lite/builtin_op_data.h
11-
tensorflow/lite/builtin_ops.h
12-
tensorflow/lite/context_util.h
13-
tensorflow/lite/core/api/flatbuffer_conversions.cc
14-
tensorflow/lite/core/api/tensor_utils.cc
15-
tensorflow/lite/core/c/common.cc
16-
tensorflow/lite/kernels/internal/common.cc
17-
tensorflow/lite/kernels/internal/quantization_util.cc
18-
tensorflow/lite/kernels/internal/tensor_ctypes.cc
19-
tensorflow/lite/kernels/internal/reference/comparisons.cc
20-
tensorflow/lite/kernels/kernel_util.cc
21-
tensorflow/lite/c/builtin_op_data.h
22-
tensorflow/lite/c/c_api_types.h
23-
tensorflow/lite/c/common.h
24-
tensorflow/lite/core/api/error_reporter.h
25-
tensorflow/lite/core/api/flatbuffer_conversions.h
26-
tensorflow/lite/core/api/tensor_utils.h
27-
tensorflow/lite/core/c/builtin_op_data.h
28-
tensorflow/lite/core/c/c_api_types.h
29-
tensorflow/lite/core/c/common.h
30-
tensorflow/lite/core/macros.h
31-
tensorflow/lite/kernels/internal/common.h
32-
tensorflow/lite/kernels/internal/compatibility.h
33-
tensorflow/lite/kernels/internal/portable_tensor_utils.h
34-
tensorflow/lite/kernels/internal/portable_tensor_utils.cc
35-
tensorflow/lite/kernels/internal/quantization_util.h
36-
tensorflow/lite/kernels/internal/reference/add.h
37-
tensorflow/lite/kernels/internal/reference/add_n.h
38-
tensorflow/lite/kernels/internal/reference/arg_min_max.h
39-
tensorflow/lite/kernels/internal/reference/batch_to_space_nd.h
40-
tensorflow/lite/kernels/internal/reference/batch_matmul.h
41-
tensorflow/lite/kernels/internal/reference/binary_function.h
42-
tensorflow/lite/kernels/internal/reference/broadcast_args.h
43-
tensorflow/lite/kernels/internal/reference/broadcast_to.h
44-
tensorflow/lite/kernels/internal/reference/ceil.h
45-
tensorflow/lite/kernels/internal/reference/comparisons.h
46-
tensorflow/lite/kernels/internal/reference/concatenation.h
47-
tensorflow/lite/kernels/internal/reference/conv.h
48-
tensorflow/lite/kernels/internal/reference/cumsum.h
49-
tensorflow/lite/kernels/internal/reference/depth_to_space.h
50-
tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h
51-
tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h
52-
tensorflow/lite/kernels/internal/reference/dequantize.h
53-
tensorflow/lite/kernels/internal/reference/div.h
54-
tensorflow/lite/kernels/internal/reference/elu.h
55-
tensorflow/lite/kernels/internal/reference/exp.h
56-
tensorflow/lite/kernels/internal/reference/fill.h
57-
tensorflow/lite/kernels/internal/reference/floor.h
58-
tensorflow/lite/kernels/internal/reference/floor_div.h
59-
tensorflow/lite/kernels/internal/reference/floor_mod.h
60-
tensorflow/lite/kernels/internal/reference/fully_connected.h
61-
tensorflow/lite/kernels/internal/reference/hard_swish.h
62-
tensorflow/lite/kernels/internal/reference/integer_ops/add.h
63-
tensorflow/lite/kernels/internal/reference/integer_ops/conv.h
64-
tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h
65-
tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h
66-
tensorflow/lite/kernels/internal/reference/integer_ops/logistic.h
67-
tensorflow/lite/kernels/internal/reference/integer_ops/l2normalization.h
68-
tensorflow/lite/kernels/internal/reference/integer_ops/mean.h
69-
tensorflow/lite/kernels/internal/reference/integer_ops/mul.h
70-
tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h
71-
tensorflow/lite/kernels/internal/reference/integer_ops/tanh.h
72-
tensorflow/lite/kernels/internal/reference/integer_ops/transpose_conv.h
73-
tensorflow/lite/kernels/internal/reference/l2normalization.h
74-
tensorflow/lite/kernels/internal/reference/leaky_relu.h
75-
tensorflow/lite/kernels/internal/reference/log_softmax.h
76-
tensorflow/lite/kernels/internal/reference/maximum_minimum.h
77-
tensorflow/lite/kernels/internal/reference/mul.h
78-
tensorflow/lite/kernels/internal/reference/neg.h
79-
tensorflow/lite/kernels/internal/reference/pad.h
80-
tensorflow/lite/kernels/internal/reference/pooling.h
81-
tensorflow/lite/kernels/internal/reference/portable_tensor_utils.cc
82-
tensorflow/lite/kernels/internal/reference/portable_tensor_utils.h
83-
tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h
84-
tensorflow/lite/kernels/internal/reference/prelu.h
85-
tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h
86-
tensorflow/lite/kernels/internal/reference/quantize.h
87-
tensorflow/lite/kernels/internal/reference/reduce.h
88-
tensorflow/lite/kernels/internal/reference/requantize.h
89-
tensorflow/lite/kernels/internal/reference/resize_bilinear.h
90-
tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h
91-
tensorflow/lite/kernels/internal/reference/reverse.h
92-
tensorflow/lite/kernels/internal/reference/round.h
93-
tensorflow/lite/kernels/internal/reference/softmax.h
94-
tensorflow/lite/kernels/internal/reference/space_to_batch_nd.h
95-
tensorflow/lite/kernels/internal/reference/space_to_depth.h
96-
tensorflow/lite/kernels/internal/reference/sub.h
97-
tensorflow/lite/kernels/internal/reference/logistic.h
98-
tensorflow/lite/kernels/internal/reference/lstm_cell.h
99-
tensorflow/lite/kernels/internal/reference/select.h
100-
tensorflow/lite/kernels/internal/reference/slice.h
101-
tensorflow/lite/kernels/internal/reference/strided_slice.h
102-
tensorflow/lite/kernels/internal/reference/tanh.h
103-
tensorflow/lite/kernels/internal/reference/transpose.h
104-
tensorflow/lite/kernels/internal/reference/transpose_conv.h
105-
tensorflow/lite/kernels/internal/cppmath.h
106-
tensorflow/lite/kernels/internal/max.h
107-
tensorflow/lite/kernels/internal/min.h
108-
tensorflow/lite/kernels/internal/portable_tensor.h
109-
tensorflow/lite/kernels/internal/strided_slice_logic.h
110-
tensorflow/lite/kernels/internal/tensor_ctypes.h
111-
tensorflow/lite/kernels/internal/types.h
112-
tensorflow/lite/kernels/kernel_util.h
113-
tensorflow/lite/kernels/padding.h
114-
tensorflow/lite/portable_type_to_tflitetype.h
115-
tensorflow/lite/python/schema_util.py
116-
tensorflow/lite/schema/schema_utils.h
117-
tensorflow/lite/tools/flatbuffer_utils.py
118-
tensorflow/lite/tools/flatbuffer_utils_test.py
119-
tensorflow/lite/tools/randomize_weights.py
120-
tensorflow/lite/tools/strip_strings.py
121-
tensorflow/lite/tools/test_utils.py
122-
tensorflow/lite/tools/visualize.py
123-
tensorflow/lite/tools/visualize_test.py
1+
tflite/converter/core/api/error_reporter.h
2+
tflite/converter/core/api/error_reporter.cc
3+
tflite/converter/core/c/builtin_op_data.h
4+
tflite/converter/core/c/tflite_types.h
5+
tflite/converter/schema/schema.fbs
6+
tflite/converter/schema/schema_utils.h
7+
tflite/converter/schema/schema_utils.cc
8+
tflite/array.h
9+
tflite/array.cc
10+
tflite/builtin_op_data.h
11+
tflite/builtin_ops.h
12+
tflite/context_util.h
13+
tflite/core/api/flatbuffer_conversions.cc
14+
tflite/core/api/tensor_utils.cc
15+
tflite/core/c/common.cc
16+
tflite/kernels/internal/common.cc
17+
tflite/kernels/internal/quantization_util.cc
18+
tflite/kernels/internal/tensor_ctypes.cc
19+
tflite/kernels/internal/reference/comparisons.cc
20+
tflite/kernels/kernel_util.cc
21+
tflite/c/builtin_op_data.h
22+
tflite/c/c_api_types.h
23+
tflite/c/common.h
24+
tflite/core/api/error_reporter.h
25+
tflite/core/api/flatbuffer_conversions.h
26+
tflite/core/api/tensor_utils.h
27+
tflite/core/c/builtin_op_data.h
28+
tflite/core/c/c_api_types.h
29+
tflite/core/c/common.h
30+
tflite/core/macros.h
31+
tflite/kernels/internal/common.h
32+
tflite/kernels/internal/compatibility.h
33+
tflite/kernels/internal/portable_tensor_utils.h
34+
tflite/kernels/internal/portable_tensor_utils.cc
35+
tflite/kernels/internal/quantization_util.h
36+
tflite/kernels/internal/reference/add.h
37+
tflite/kernels/internal/reference/add_n.h
38+
tflite/kernels/internal/reference/arg_min_max.h
39+
tflite/kernels/internal/reference/batch_to_space_nd.h
40+
tflite/kernels/internal/reference/batch_matmul.h
41+
tflite/kernels/internal/reference/binary_function.h
42+
tflite/kernels/internal/reference/broadcast_args.h
43+
tflite/kernels/internal/reference/broadcast_to.h
44+
tflite/kernels/internal/reference/ceil.h
45+
tflite/kernels/internal/reference/comparisons.h
46+
tflite/kernels/internal/reference/concatenation.h
47+
tflite/kernels/internal/reference/conv.h
48+
tflite/kernels/internal/reference/cumsum.h
49+
tflite/kernels/internal/reference/depth_to_space.h
50+
tflite/kernels/internal/reference/depthwiseconv_float.h
51+
tflite/kernels/internal/reference/depthwiseconv_uint8.h
52+
tflite/kernels/internal/reference/dequantize.h
53+
tflite/kernels/internal/reference/div.h
54+
tflite/kernels/internal/reference/elu.h
55+
tflite/kernels/internal/reference/exp.h
56+
tflite/kernels/internal/reference/fill.h
57+
tflite/kernels/internal/reference/floor.h
58+
tflite/kernels/internal/reference/floor_div.h
59+
tflite/kernels/internal/reference/floor_mod.h
60+
tflite/kernels/internal/reference/fully_connected.h
61+
tflite/kernels/internal/reference/hard_swish.h
62+
tflite/kernels/internal/reference/integer_ops/add.h
63+
tflite/kernels/internal/reference/integer_ops/conv.h
64+
tflite/kernels/internal/reference/integer_ops/depthwise_conv.h
65+
tflite/kernels/internal/reference/integer_ops/fully_connected.h
66+
tflite/kernels/internal/reference/integer_ops/logistic.h
67+
tflite/kernels/internal/reference/integer_ops/l2normalization.h
68+
tflite/kernels/internal/reference/integer_ops/mean.h
69+
tflite/kernels/internal/reference/integer_ops/mul.h
70+
tflite/kernels/internal/reference/integer_ops/pooling.h
71+
tflite/kernels/internal/reference/integer_ops/tanh.h
72+
tflite/kernels/internal/reference/integer_ops/transpose_conv.h
73+
tflite/kernels/internal/reference/l2normalization.h
74+
tflite/kernels/internal/reference/leaky_relu.h
75+
tflite/kernels/internal/reference/log_softmax.h
76+
tflite/kernels/internal/reference/maximum_minimum.h
77+
tflite/kernels/internal/reference/mul.h
78+
tflite/kernels/internal/reference/neg.h
79+
tflite/kernels/internal/reference/pad.h
80+
tflite/kernels/internal/reference/pooling.h
81+
tflite/kernels/internal/reference/portable_tensor_utils.cc
82+
tflite/kernels/internal/reference/portable_tensor_utils.h
83+
tflite/kernels/internal/reference/portable_tensor_utils_impl.h
84+
tflite/kernels/internal/reference/prelu.h
85+
tflite/kernels/internal/reference/process_broadcast_shapes.h
86+
tflite/kernels/internal/reference/quantize.h
87+
tflite/kernels/internal/reference/reduce.h
88+
tflite/kernels/internal/reference/requantize.h
89+
tflite/kernels/internal/reference/resize_bilinear.h
90+
tflite/kernels/internal/reference/resize_nearest_neighbor.h
91+
tflite/kernels/internal/reference/reverse.h
92+
tflite/kernels/internal/reference/round.h
93+
tflite/kernels/internal/reference/softmax.h
94+
tflite/kernels/internal/reference/space_to_batch_nd.h
95+
tflite/kernels/internal/reference/space_to_depth.h
96+
tflite/kernels/internal/reference/sub.h
97+
tflite/kernels/internal/reference/logistic.h
98+
tflite/kernels/internal/reference/lstm_cell.h
99+
tflite/kernels/internal/reference/select.h
100+
tflite/kernels/internal/reference/slice.h
101+
tflite/kernels/internal/reference/strided_slice.h
102+
tflite/kernels/internal/reference/tanh.h
103+
tflite/kernels/internal/reference/transpose.h
104+
tflite/kernels/internal/reference/transpose_conv.h
105+
tflite/kernels/internal/cppmath.h
106+
tflite/kernels/internal/max.h
107+
tflite/kernels/internal/min.h
108+
tflite/kernels/internal/portable_tensor.h
109+
tflite/kernels/internal/strided_slice_logic.h
110+
tflite/kernels/internal/tensor_ctypes.h
111+
tflite/kernels/internal/types.h
112+
tflite/kernels/kernel_util.h
113+
tflite/kernels/padding.h
114+
tflite/portable_type_to_tflitetype.h
115+
tflite/python/schema_util.py
116+
tflite/schema/schema_utils.h
117+
tflite/tools/flatbuffer_utils.py
118+
tflite/tools/flatbuffer_utils_test.py
119+
tflite/tools/randomize_weights.py
120+
tflite/tools/strip_strings.py
121+
tflite/tools/test_utils.py
122+
tflite/tools/visualize.py
123+
tflite/tools/visualize_test.py

tensorflow/compiler/mlir/lite/schema/schema.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ enum BuiltinOperator : int32 {
489489
STABLEHLO_CBRT = 208, // WARNING: No runtime support
490490
STABLEHLO_CASE = 209,
491491
}
492-
// LINT.ThenChange(nnapi_linter/linter.proto)
492+
// LINT.ThenChange(internal-1)
493493

494494
// Options for the builtin operators.
495495
union BuiltinOptions {

tensorflow/lite/c/builtin_op_data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
#define TENSORFLOW_LITE_C_BUILTIN_OP_DATA_H_
1717

1818
/// For documentation, see
19-
/// third_party/tensorflow/lite/core/c/builtin_op_data.h
19+
/// tensorflow/lite/core/c/builtin_op_data.h
2020

2121
#include "tensorflow/lite/core/c/builtin_op_data.h"
2222

tensorflow/lite/core/c/builtin_op_data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ limitations under the License.
1414
==============================================================================*/
1515
/// WARNING: Users of TensorFlow Lite should not include this file directly,
1616
/// but should instead include
17-
/// "third_party/tensorflow/lite/c/builtin_op_data.h".
17+
/// "tensorflow/lite/c/builtin_op_data.h".
1818
/// Only the TensorFlow Lite implementation itself should include this
1919
/// file directly.
2020
#ifndef TENSORFLOW_LITE_CORE_C_BUILTIN_OP_DATA_H_

tensorflow/lite/core/c/c_api_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515
// WARNING: Users of TensorFlow Lite should not include this file directly, but
16-
// should instead include "third_party/tensorflow/lite/c/c_api_types.h".
16+
// should instead include "tensorflow/lite/c/c_api_types.h".
1717
// Only the TensorFlow Lite implementation itself should include this file
1818
// directly.
1919

@@ -31,7 +31,7 @@ limitations under the License.
3131
// NOLINTEND(whitespace/line_length)
3232
// clang-format on
3333

34-
// IWYU pragma: private, include "third_party/tensorflow/lite/c/c_api_types.h"
34+
// IWYU pragma: private, include "tensorflow/lite/c/c_api_types.h"
3535

3636
#ifndef TENSORFLOW_LITE_CORE_C_C_API_TYPES_H_
3737
#define TENSORFLOW_LITE_CORE_C_C_API_TYPES_H_

tensorflow/lite/core/c/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515
// WARNING: Users of TensorFlow Lite should not include this file directly, but
16-
// should instead include "third_party/tensorflow/lite/c/common.h".
16+
// should instead include "tensorflow/lite/c/common.h".
1717
// Only the TensorFlow Lite implementation itself should include this file
1818
// directly.
1919

@@ -47,7 +47,7 @@ limitations under the License.
4747
// NOLINTEND(whitespace/line_length)
4848
// clang-format on
4949

50-
// IWYU pragma: private, include "third_party/tensorflow/lite/c/common.h"
50+
// IWYU pragma: private, include "tensorflow/lite/c/common.h"
5151

5252
#ifndef TENSORFLOW_LITE_CORE_C_COMMON_H_
5353
#define TENSORFLOW_LITE_CORE_C_COMMON_H_

0 commit comments

Comments
 (0)