Skip to content

Commit

Permalink
Migrate TensorFlow Lite out of tensorflow/contrib
Browse files Browse the repository at this point in the history
This change moves //tensorflow/contrib/lite to //tensorflow/lite in preparation
for TensorFlow 2.0's deprecation of contrib/. If you refer to TF Lite build
targets or headers, you will need to update them manually. If you use TF Lite
from the TensorFlow python package, "tf.contrib.lite" now points to "tf.lite".
Please update your imports as soon as possible.

For more details, see https://groups.google.com/a/tensorflow.org/forum/#!topic/tflite/iIIXOTOFvwQ

@angersson and @aselle are conducting this migration. Please contact them if
you have any further questions.

PiperOrigin-RevId: 219536476
  • Loading branch information
angerson authored and tensorflower-gardener committed Oct 31, 2018
1 parent 0f8f062 commit 61c6c84
Show file tree
Hide file tree
Showing 1,205 changed files with 4,284 additions and 4,242 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Pods
Podfile.lock
*.pbxproj
*.xcworkspacedata
/tensorflow/contrib/lite/downloads/**
/tensorflow/contrib/lite/gen/**
/tensorflow/contrib/lite/examples/ios/simple/data/*.txt
/tensorflow/contrib/lite/examples/ios/simple/data/*.tflite
/tensorflow/lite/downloads/**
/tensorflow/lite/gen/**
/tensorflow/lite/examples/ios/simple/data/*.txt
/tensorflow/lite/examples/ios/simple/data/*.tflite
xcuserdata/**
/api_init_files_list.txt
/estimator_api_init_files_list.txt
Expand Down
8 changes: 4 additions & 4 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ Ag Ramesh, Alex Wiltschko, Alexander Pantyukhin, Amogh Mannekote, An Jiaoyang, A
* Update `tf.keras` to the Keras 2.1.6 API.
* Added [`tf.keras.layers.CuDNNGRU`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNGRU) and [`tf.keras.layers.CuDNNLSTM`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNLSTM) layers. [Try it](https://colab.sandbox.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb?linkId=53292082).
* Adding support of core [feature columns](https://www.tensorflow.org/get_started/feature_columns) and [losses](https://www.tensorflow.org/api_docs/python/tf/losses) to [gradient boosted trees estimators](https://github.com/tensorflow/models/tree/master/official/boosted_trees).
* The [python interface](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/lite)
for the [TFLite Optimizing Converter](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/toco/README.md)
* The [python interface](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/lite)
for the [TFLite Optimizing Converter](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/toco/README.md)
has been expanded, and the command line interface (AKA: `toco`, `tflite_convert`) is once again
included in the standard `pip` installation.
* Improved data-loading and text processing with:
Expand Down Expand Up @@ -562,7 +562,7 @@ Yoni Tsafir, yordun, Yuan (Terry) Tang, Yuxin Wu, zhengdi, Zhengsheng Wei, 田
## Major Features And Improvements
* [Eager execution](https://github.com/tensorflow/tensorflow/tree/r1.5/tensorflow/contrib/eager)
preview version is now available.
* [TensorFlow Lite](https://github.com/tensorflow/tensorflow/tree/r1.5/tensorflow/contrib/lite)
* [TensorFlow Lite](https://github.com/tensorflow/tensorflow/tree/r1.5/tensorflow/lite)
dev preview is now available.
* CUDA 9.0 and cuDNN 7 support.
* Accelerated Linear Algebra (XLA):
Expand Down Expand Up @@ -909,7 +909,7 @@ See also [TensorBoard 0.1.4](https://github.com/tensorflow/tensorboard/releases/
* Adds tf.contrib.nn.rank_sampled_softmax_loss, a sampled-softmax variant that can improve rank loss.
* `tf.contrib.metrics`.{streaming_covariance,streaming_pearson_correlation} modified to return nan when they have seen less or equal to 1 unit of weight.
* Adds time series models to contrib. See contrib/timeseries/README.md for details.
* Adds FULLY_CONNECTED Op to tensorflow/contrib/lite/schema.fbs
* Adds FULLY_CONNECTED Op to tensorflow/lite/schema.fbs

## Known Issues
* Tensorflow_gpu compilation fails with Bazel 0.5.3.
Expand Down
8 changes: 4 additions & 4 deletions tensorflow/contrib/cmake/python_modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ tensorflow/contrib/linear_optimizer/kernels/g3doc
tensorflow/contrib/linear_optimizer/python
tensorflow/contrib/linear_optimizer/python/ops
# TODO(drpngx): Fix failing imports
# tensorflow/contrib/lite
# tensorflow/contrib/lite/python
# tensorflow/contrib/lite/toco
# tensorflow/contrib/lite/toco/python
# tensorflow/lite
# tensorflow/lite/python
# tensorflow/lite/toco
# tensorflow/lite/toco/python
tensorflow/contrib/lookup
tensorflow/contrib/losses
tensorflow/contrib/losses/python
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/contrib/cmake/python_protos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tensorflow/contrib/boosted_trees/proto
tensorflow/contrib/cloud/kernels
tensorflow/contrib/decision_trees/proto
tensorflow/contrib/gdr
tensorflow/contrib/lite/toco
tensorflow/lite/toco
tensorflow/contrib/mpi
tensorflow/contrib/mpi_collectives
tensorflow/contrib/session_bundle
Expand Down
8 changes: 4 additions & 4 deletions tensorflow/contrib/cmake/tf_python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ endforeach(python_module)

add_custom_command(TARGET tf_python_touchup_modules PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/contrib/lite")
"${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/lite")
add_custom_command(TARGET tf_python_touchup_modules PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/contrib/lite/python")
"${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/lite/python")
add_custom_command(TARGET tf_python_touchup_modules PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E touch
"${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/contrib/lite/python/__init__.py")
"${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/lite/python/__init__.py")
add_custom_command(
TARGET tf_python_copy_scripts_to_destination PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/contrib/lite/python/lite.py)
${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/lite/python/lite.py)

# Generate the tensorflow.python.platform.build_info module.
set(BUILD_INFO_PY "${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/python/platform/build_info.py")
Expand Down
107 changes: 0 additions & 107 deletions tensorflow/contrib/lite/experimental/micro/kernels/BUILD

This file was deleted.

182 changes: 4 additions & 178 deletions tensorflow/contrib/lite/python/BUILD
Original file line number Diff line number Diff line change
@@ -1,186 +1,12 @@
licenses(["notice"]) # Apache 2.0

package(default_visibility = ["//tensorflow:internal"])

load("//tensorflow:tensorflow.bzl", "py_test")

filegroup(
name = "interpreter_test_data",
srcs = glob(["**/testdata/*"]),
visibility = ["//tensorflow:__subpackages__"],
)

py_library(
name = "interpreter",
srcs = [
"interpreter.py",
],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
"//tensorflow/contrib/lite/python/interpreter_wrapper:tensorflow_wrap_interpreter_wrapper",
"//tensorflow/python:util",
"//third_party/py/numpy",
],
)

py_test(
name = "interpreter_test",
srcs = ["interpreter_test.py"],
data = [":interpreter_test_data"],
srcs_version = "PY2AND3",
tags = ["no_oss"],
deps = [
":interpreter",
"//tensorflow/python:client_testlib",
"//tensorflow/python:framework_test_lib",
"//tensorflow/python:platform",
"//third_party/py/numpy",
],
)

py_binary(
name = "tflite_convert",
srcs = ["tflite_convert.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
":lite",
],
)
licenses(["notice"])

# DO NOT USE THIS TARGET. TensorFlow Lite has moved to tensorflow/lite.
py_library(
name = "lite",
srcs = ["lite.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
":convert",
":convert_saved_model",
":interpreter",
":lite_constants",
":op_hint",
"//tensorflow/python:graph_util",
"//tensorflow/python/keras",
"//tensorflow/python/saved_model:constants",
"//tensorflow/python/saved_model:loader",
],
)

py_test(
name = "lite_test",
srcs = ["lite_test.py"],
data = ["@tflite_mobilenet_ssd_quant_protobuf//:tflite_graph.pb"],
srcs = ["__init__.py"],
srcs_version = "PY2AND3",
tags = [
"no_oss",
"no_windows",
],
deps = [
":lite",
"//tensorflow/python:client_testlib",
"//tensorflow/python:framework_test_lib",
],
)

py_library(
name = "lite_constants",
srcs = ["lite_constants.py"],
srcs_version = "PY2AND3",
deps = [
"//tensorflow/contrib/lite/toco:toco_flags_proto_py",
],
)

py_library(
name = "convert",
srcs = ["convert.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
":lite_constants",
"//tensorflow/contrib/lite/toco:model_flags_proto_py",
"//tensorflow/contrib/lite/toco:toco_flags_proto_py",
"//tensorflow/contrib/lite/toco/python:tensorflow_wrap_toco",
"//tensorflow/contrib/lite/toco/python:toco_from_protos",
"//tensorflow/python:platform",
],
)

py_library(
name = "op_hint",
srcs = ["op_hint.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
"//tensorflow/contrib/framework:framework_py",
"//tensorflow/contrib/graph_editor:graph_editor_py",
"//tensorflow/core:protos_all_py",
"//tensorflow/python:framework",
"//tensorflow/python:platform",
"//tensorflow/python:util",
],
)

py_test(
name = "convert_test",
srcs = ["convert_test.py"],
srcs_version = "PY2AND3",
deps = [
":convert",
":interpreter",
":op_hint",
"//tensorflow/python:array_ops",
"//tensorflow/python:client_testlib",
"//tensorflow/python:dtypes",
"//tensorflow/python:platform_test",
"//tensorflow/python:session",
],
)

py_library(
name = "convert_saved_model",
srcs = ["convert_saved_model.py"],
srcs_version = "PY2AND3",
visibility = ["//tensorflow/contrib/lite:__subpackages__"],
deps = [
":convert",
"//tensorflow/python:graph_util",
"//tensorflow/python:platform",
"//tensorflow/python/saved_model",
],
)

py_binary(
name = "create_custom_op",
srcs = ["create_custom_op.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
"//tensorflow/contrib/framework:framework_py",
"//tensorflow/core:protos_all_py",
"//tensorflow/python:platform",
"@absl_py//absl/flags",
],
)

py_test(
name = "convert_saved_model_test",
srcs = ["convert_saved_model_test.py"],
srcs_version = "PY2AND3",
tags = [
"no_windows",
],
visibility = ["//visibility:public"],
deps = [
":convert_saved_model",
"//tensorflow/python:client_testlib",
"//tensorflow/python:layers",
"//tensorflow/python:nn",
"//tensorflow/python:platform_test",
"//tensorflow/python:session",
"//tensorflow/python/keras",
"//tensorflow/python/ops/losses",
"//tensorflow/python/saved_model",
"//tensorflow/lite/python:lite",
],
)
Loading

0 comments on commit 61c6c84

Please sign in to comment.