aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tensorflow/BUILD18
-rw-r--r--tensorflow/api_template.__init__.py3
-rw-r--r--tensorflow/contrib/BUILD1
-rw-r--r--tensorflow/contrib/cmake/python_modules.txt1
-rw-r--r--tensorflow/python/BUILD3
-rw-r--r--tensorflow/python/__init__.py1
-rw-r--r--tensorflow/python/estimator/BUILD410
-rw-r--r--tensorflow/python/estimator/__init__.py25
-rw-r--r--tensorflow/python/estimator/api/BUILD1
-rw-r--r--tensorflow/python/estimator/keras.py2
-rwxr-xr-xtensorflow/python/keras/BUILD1
-rw-r--r--tensorflow/python/keras/__init__.py1
-rw-r--r--tensorflow/python/keras/estimator/__init__.py46
-rw-r--r--tensorflow/tools/api/generator/BUILD30
-rw-r--r--tensorflow/tools/api/generator/api_gen.bzl32
-rw-r--r--tensorflow/tools/api/generator/doc_srcs.py2
16 files changed, 187 insertions, 390 deletions
diff --git a/tensorflow/BUILD b/tensorflow/BUILD
index 6d134dbb80..8d0d9f14bc 100644
--- a/tensorflow/BUILD
+++ b/tensorflow/BUILD
@@ -398,6 +398,7 @@ config_setting(
package_group(
name = "internal",
packages = [
+ "-//third_party/tensorflow/python/estimator",
"//learning/meta_rank/...",
"//tensorflow/...",
"//tensorflow_fold/llgtm/...",
@@ -546,11 +547,20 @@ gen_api_init_files(
py_library(
name = "tensorflow_py",
- srcs = [
- ":tensorflow_python_api_gen",
- "//tensorflow/python/estimator/api:estimator_python_api_gen",
+ srcs = ["//tensorflow/python/estimator/api:estimator_python_api_gen"],
+ srcs_version = "PY2AND3",
+ visibility = ["//visibility:public"],
+ deps = [
+ ":tensorflow_py_no_contrib",
+ "//tensorflow/contrib:contrib_py",
+ "//tensorflow/python/estimator:estimator_py",
],
+)
+
+py_library(
+ name = "tensorflow_py_no_contrib",
+ srcs = [":tensorflow_python_api_gen"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
- deps = ["//tensorflow/python"],
+ deps = ["//tensorflow/python:no_contrib"],
)
diff --git a/tensorflow/api_template.__init__.py b/tensorflow/api_template.__init__.py
index 9662d7b478..779f65d5b1 100644
--- a/tensorflow/api_template.__init__.py
+++ b/tensorflow/api_template.__init__.py
@@ -20,7 +20,6 @@ from __future__ import print_function
# pylint: disable=g-bad-import-order
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
-# API IMPORTS PLACEHOLDER
try:
import os # pylint: disable=g-import-not-at-top
@@ -37,6 +36,8 @@ try:
except (ImportError, AttributeError):
print('tf.estimator package not installed.')
+# API IMPORTS PLACEHOLDER
+
from tensorflow.python.util.lazy_loader import LazyLoader # pylint: disable=g-import-not-at-top
contrib = LazyLoader('contrib', globals(), 'tensorflow.contrib')
del LazyLoader
diff --git a/tensorflow/contrib/BUILD b/tensorflow/contrib/BUILD
index 7d44a054a8..fffab5a795 100644
--- a/tensorflow/contrib/BUILD
+++ b/tensorflow/contrib/BUILD
@@ -114,6 +114,7 @@ py_library(
"//tensorflow/contrib/training:training_py",
"//tensorflow/contrib/util:util_py",
"//tensorflow/python:util",
+ "//tensorflow/python/estimator:estimator_py",
] + if_mpi(["//tensorflow/contrib/mpi_collectives:mpi_collectives_py"]) + if_tensorrt([
"//tensorflow/contrib/tensorrt:init_py",
]) + select({
diff --git a/tensorflow/contrib/cmake/python_modules.txt b/tensorflow/contrib/cmake/python_modules.txt
index 8a45858ae4..d530572e91 100644
--- a/tensorflow/contrib/cmake/python_modules.txt
+++ b/tensorflow/contrib/cmake/python_modules.txt
@@ -35,6 +35,7 @@ tensorflow/python/keras
tensorflow/python/keras/applications
tensorflow/python/keras/datasets
tensorflow/python/keras/engine
+tensorflow/python/keras/estimator
tensorflow/python/keras/layers
tensorflow/python/keras/preprocessing
tensorflow/python/keras/utils
diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD
index d1561f5c57..c1b59e44a6 100644
--- a/tensorflow/python/BUILD
+++ b/tensorflow/python/BUILD
@@ -57,12 +57,12 @@ py_library(
"//tensorflow/contrib/lite/toco/python:__pkg__", # TODO(b/34059704): remove when fixed
"//tensorflow/python/debug:__pkg__", # TODO(b/34059704): remove when fixed
"//tensorflow/python/tools:__pkg__", # TODO(b/34059704): remove when fixed
- "//tensorflow/tools/api/generator:__pkg__",
"//tensorflow/tools/quantization:__pkg__", # TODO(b/34059704): remove when fixed
],
deps = [
":no_contrib",
"//tensorflow/contrib:contrib_py",
+ "//tensorflow/python/estimator:estimator_py",
],
)
@@ -128,7 +128,6 @@ py_library(
":weights_broadcast_ops",
"//tensorflow/core:protos_all_py",
"//tensorflow/python/data",
- "//tensorflow/python/estimator:estimator_py",
"//tensorflow/python/feature_column:feature_column_py",
"//tensorflow/python/keras",
"//tensorflow/python/ops/distributions",
diff --git a/tensorflow/python/__init__.py b/tensorflow/python/__init__.py
index cf707fb2c7..a2ab63bb48 100644
--- a/tensorflow/python/__init__.py
+++ b/tensorflow/python/__init__.py
@@ -79,7 +79,6 @@ from tensorflow.python.ops import initializers_ns as initializers
# Bring in subpackages.
from tensorflow.python import data
from tensorflow.python import keras
-from tensorflow.python.estimator import estimator_lib as estimator
from tensorflow.python.feature_column import feature_column_lib as feature_column
from tensorflow.python.layers import layers
from tensorflow.python.ops import bitwise_ops as bitwise
diff --git a/tensorflow/python/estimator/BUILD b/tensorflow/python/estimator/BUILD
index 326019ff2a..38e446da0c 100644
--- a/tensorflow/python/estimator/BUILD
+++ b/tensorflow/python/estimator/BUILD
@@ -10,7 +10,10 @@ load("//tensorflow:tensorflow.bzl", "py_test")
py_library(
name = "estimator_py",
- srcs = ["estimator_lib.py"],
+ srcs = [
+ "__init__.py",
+ "estimator_lib.py",
+ ],
srcs_version = "PY2AND3",
visibility = [
"//tensorflow:__pkg__",
@@ -31,7 +34,7 @@ py_library(
":parsing_utils",
":run_config",
":training",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -41,10 +44,7 @@ py_library(
srcs_version = "PY2AND3",
deps = [
":gc",
- "//tensorflow/python:errors",
- "//tensorflow/python:platform",
- "//tensorflow/python:summary",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
"//tensorflow/python/estimator:metric_keys",
"//tensorflow/python/estimator:util",
],
@@ -58,10 +58,7 @@ py_test(
deps = [
":estimator",
":exporter",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:platform",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -70,8 +67,7 @@ py_library(
srcs = ["gc.py"],
srcs_version = "PY2AND3",
deps = [
- "//tensorflow/python:platform",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -82,10 +78,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":gc",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:framework_test_lib",
- "//tensorflow/python:platform",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -95,12 +88,7 @@ py_library(
srcs_version = "PY2AND3",
deps = [
":export_output",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:framework_for_generated_wrappers",
- "//tensorflow/python:training",
- "//tensorflow/python:util",
- "//tensorflow/python/saved_model:signature_constants",
- "//tensorflow/python/saved_model:tag_constants",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -113,12 +101,7 @@ py_test(
deps = [
":export_output",
":model_fn",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:framework_for_generated_wrappers",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python:training",
- "//tensorflow/python/saved_model:signature_constants",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -130,11 +113,7 @@ py_library(
":estimator",
":exporter",
":run_config",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:training",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -153,13 +132,7 @@ py_test(
":inputs",
":run_config",
":training",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:training",
- "//tensorflow/python:util",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -168,7 +141,7 @@ py_library(
srcs = ["run_config.py"],
srcs_version = "PY2AND3",
deps = [
- "//tensorflow/core:protos_all_py",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -180,8 +153,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":run_config",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:client_testlib",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -194,14 +166,7 @@ py_library(
":head",
":model_fn",
":optimizers",
- "//tensorflow/python:init_ops",
- "//tensorflow/python:layers",
- "//tensorflow/python:nn",
- "//tensorflow/python:partitioned_variables",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:variable_scope",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -225,26 +190,7 @@ py_test(
":numpy_io",
":pandas_io",
":run_config",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:check_ops",
- "//tensorflow/python:client",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:constant_op",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:data_flow_ops",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python:state_ops",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:variable_scope",
- "//tensorflow/python:variables",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -257,20 +203,7 @@ py_library(
":estimator",
":head",
":model_fn",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:boosted_trees_ops",
- "//tensorflow/python:data_flow_ops",
- "//tensorflow/python:distribute",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:lookup_ops",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:state_ops",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:variable_scope",
- "//tensorflow/python/feature_column",
- "//tensorflow/python/ops/losses",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -284,19 +217,8 @@ py_test(
],
deps = [
":boosted_trees",
- "//tensorflow/core/kernels/boosted_trees:boosted_trees_proto_py",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:constant_op",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_test_lib",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:platform_test",
- "//tensorflow/python:resources",
- "//tensorflow/python:training",
- "//tensorflow/python/estimator:numpy_io",
- "//tensorflow/python/feature_column",
+ ":inputs",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -309,14 +231,7 @@ py_library(
":head",
":model_fn",
":optimizers",
- "//tensorflow/python:init_ops",
- "//tensorflow/python:layers",
- "//tensorflow/python:nn",
- "//tensorflow/python:partitioned_variables",
- "//tensorflow/python:summary",
- "//tensorflow/python:variable_scope",
- "//tensorflow/python/feature_column",
- "//tensorflow/python/ops/losses",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -333,22 +248,7 @@ py_library(
":model_fn",
":numpy_io",
":prediction_keys",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:check_ops",
- "//tensorflow/python:client",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:constant_op",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:distribute",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:state_ops",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:variables",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
"//third_party/py/numpy",
"@six_archive//:six",
],
@@ -371,16 +271,7 @@ py_test(
":numpy_io",
":pandas_io",
":prediction_keys",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:data_flow_ops",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -396,19 +287,7 @@ py_library(
":linear",
":model_fn",
":optimizers",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:distribute",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:init_ops",
- "//tensorflow/python:layers",
- "//tensorflow/python:nn",
- "//tensorflow/python:partitioned_variables",
- "//tensorflow/python:state_ops",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:variable_scope",
- "//tensorflow/python/feature_column",
- "//tensorflow/python/ops/losses",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -431,17 +310,7 @@ py_test(
":numpy_io",
":pandas_io",
":prediction_keys",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:nn",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:variables",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -453,10 +322,7 @@ py_library(
],
srcs_version = "PY2AND3",
deps = [
- "//tensorflow/python:platform",
- "//tensorflow/python:training",
- "//tensorflow/python:util",
- "//tensorflow/python/data",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -467,10 +333,7 @@ py_test(
tags = ["notsan"], # b/67510291
deps = [
":util",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:constant_op",
- "//tensorflow/python:training",
- "//tensorflow/python/data",
+ "//tensorflow:tensorflow_py_no_contrib",
"//third_party/py/numpy",
"@six_archive//:six",
],
@@ -487,21 +350,7 @@ py_library(
":model_fn",
":run_config",
":util",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:client",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:distribute",
- "//tensorflow/python:framework_for_generated_wrappers",
- "//tensorflow/python:metrics",
- "//tensorflow/python:platform",
- "//tensorflow/python:random_seed",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:util",
- "//tensorflow/python/data",
- "//tensorflow/python/saved_model:builder",
- "//tensorflow/python/saved_model:constants",
- "//tensorflow/python/saved_model:tag_constants",
+ "//tensorflow:tensorflow_py_no_contrib",
"//third_party/py/numpy",
"@six_archive//:six",
],
@@ -520,29 +369,7 @@ py_test(
":model_fn",
":numpy_io",
":run_config",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:check_ops",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:framework_for_generated_wrappers",
- "//tensorflow/python:init_ops",
- "//tensorflow/python:layers",
- "//tensorflow/python:lib",
- "//tensorflow/python:lookup_ops",
- "//tensorflow/python:metrics",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:saver_test_utils",
- "//tensorflow/python:session",
- "//tensorflow/python:state_ops",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:util",
- "//tensorflow/python:variables",
- "//tensorflow/python/data",
- "//tensorflow/python/ops/losses",
- "//tensorflow/python/saved_model:loader",
- "//tensorflow/python/saved_model:tag_constants",
+ "//tensorflow:tensorflow_py_no_contrib",
"//third_party/py/numpy",
"@six_archive//:six",
],
@@ -555,9 +382,7 @@ py_library(
],
srcs_version = "PY2AND3",
deps = [
- "//tensorflow/python:dtypes",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -568,10 +393,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":parsing_utils",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -580,9 +402,7 @@ py_library(
srcs = ["export/export_output.py"],
srcs_version = "PY2AND3",
deps = [
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python/saved_model:signature_def_utils",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -594,13 +414,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":export_output",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:constant_op",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python/saved_model:signature_constants",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -613,7 +427,7 @@ py_library(
deps = [
":export_export",
":export_output",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -625,13 +439,7 @@ py_library(
srcs_version = "PY2AND3",
deps = [
":util",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python:tensor_shape",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -644,17 +452,8 @@ py_test(
deps = [
":export_export",
":export_output",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:constant_op",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:framework_test_lib",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python/saved_model:signature_constants",
- "//tensorflow/python/saved_model:signature_def_utils",
+ ":util",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -667,24 +466,7 @@ py_library(
":metric_keys",
":model_fn",
":prediction_keys",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:check_ops",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:lookup_ops",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:metrics",
- "//tensorflow/python:nn",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python:string_ops",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:util",
- "//tensorflow/python:weights_broadcast_ops",
- "//tensorflow/python/feature_column",
- "//tensorflow/python/ops/losses",
- "//tensorflow/python/saved_model:signature_constants",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -703,23 +485,7 @@ py_test(
":model_fn",
":numpy_io",
":prediction_keys",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:array_ops",
- "//tensorflow/python:check_ops",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:constant_op",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:errors",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python:string_ops",
- "//tensorflow/python:training",
- "//tensorflow/python:variables",
- "//tensorflow/python/feature_column",
- "//tensorflow/python/ops/losses",
- "//tensorflow/python/saved_model:signature_constants",
+ "//tensorflow:tensorflow_py_no_contrib",
"//third_party/py/numpy",
"@six_archive//:six",
],
@@ -732,7 +498,7 @@ py_library(
deps = [
":numpy_io",
":pandas_io",
- "//tensorflow/python:util",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -744,11 +510,7 @@ py_library(
":estimator",
":head",
":optimizers",
- "//tensorflow/python:partitioned_variables",
- "//tensorflow/python:training",
- "//tensorflow/python:variable_scope",
- "//tensorflow/python/feature_column",
- "//tensorflow/python/ops/losses",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -766,25 +528,7 @@ py_library(
":numpy_io",
":pandas_io",
":run_config",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:check_ops",
- "//tensorflow/python:client",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:control_flow_ops",
- "//tensorflow/python:data_flow_ops",
- "//tensorflow/python:distribute",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:parsing_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python:state_ops",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
- "//tensorflow/python:variable_scope",
- "//tensorflow/python:variables",
- "//tensorflow/python/feature_column",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -802,7 +546,7 @@ py_test(
deps = [
":linear",
":linear_testing_utils",
- "//tensorflow/python:client_testlib",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -831,9 +575,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":numpy_io",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:errors",
- "//tensorflow/python:training",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -842,7 +584,7 @@ py_library(
srcs = ["canned/optimizers.py"],
srcs_version = "PY2AND3",
deps = [
- "//tensorflow/python:training",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -854,8 +596,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":optimizers",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:training",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -873,9 +614,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":pandas_io",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:errors",
- "//tensorflow/python:training",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -895,15 +634,7 @@ py_library(
],
srcs_version = "PY2AND3",
deps = [
- "//tensorflow/python:array_ops",
- "//tensorflow/python:data_flow_ops",
- "//tensorflow/python:dtypes",
- "//tensorflow/python:errors",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:platform",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
+ "//tensorflow:tensorflow_py_no_contrib",
"@six_archive//:six",
],
)
@@ -917,7 +648,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":inputs_queues",
- "//tensorflow/python:client_testlib",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -928,10 +659,7 @@ py_test(
srcs_version = "PY2AND3",
deps = [
":inputs_queues",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:session",
- "//tensorflow/python:training",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -944,32 +672,7 @@ py_library(
":export_export",
":model_fn",
":run_config",
- "//tensorflow/python:check_ops",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:init_ops",
- "//tensorflow/python:layers",
- "//tensorflow/python:math_ops",
- "//tensorflow/python:metrics",
- "//tensorflow/python:nn",
- "//tensorflow/python:partitioned_variables",
- "//tensorflow/python:platform",
- "//tensorflow/python:random_seed",
- "//tensorflow/python:session",
- "//tensorflow/python:sparse_tensor",
- "//tensorflow/python:summary",
- "//tensorflow/python:tensor_util",
- "//tensorflow/python:training",
- "//tensorflow/python:training_util",
- "//tensorflow/python:util",
- "//tensorflow/python:variable_scope",
- "//tensorflow/python:variables",
- "//tensorflow/python/feature_column",
- "//tensorflow/python/keras:backend",
- "//tensorflow/python/keras:engine",
- "//tensorflow/python/keras:layers",
- "//tensorflow/python/ops/losses",
- "//tensorflow/python/saved_model",
- "//tensorflow/python/saved_model:signature_constants",
+ "//tensorflow:tensorflow_py_no_contrib",
],
)
@@ -984,18 +687,9 @@ py_test(
],
deps = [
":keras",
- "//tensorflow/core:protos_all_py",
- "//tensorflow/python:client_testlib",
- "//tensorflow/python:framework_ops",
- "//tensorflow/python:framework_test_lib",
- "//tensorflow/python:platform",
- "//tensorflow/python:summary",
- "//tensorflow/python:training",
+ "//tensorflow:tensorflow_py_no_contrib",
"//tensorflow/python/estimator:numpy_io",
"//tensorflow/python/estimator:run_config",
- "//tensorflow/python/keras",
- "//tensorflow/python/keras:backend",
- "//tensorflow/python/keras:engine",
"//third_party/py/numpy",
],
)
diff --git a/tensorflow/python/estimator/__init__.py b/tensorflow/python/estimator/__init__.py
index e69de29bb2..8cf8df567f 100644
--- a/tensorflow/python/estimator/__init__.py
+++ b/tensorflow/python/estimator/__init__.py
@@ -0,0 +1,25 @@
+# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+"""Import Estimator APIs.
+
+Note: This file is imported by the create_estimator_api genrule. It must
+transitively import all Estimator modules/packages for their @estimator_export
+annotations to generate the public Estimator python API.
+"""
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
+import tensorflow.python.estimator.estimator_lib
diff --git a/tensorflow/python/estimator/api/BUILD b/tensorflow/python/estimator/api/BUILD
index cddee9b8f3..aa5a29e6dd 100644
--- a/tensorflow/python/estimator/api/BUILD
+++ b/tensorflow/python/estimator/api/BUILD
@@ -14,4 +14,5 @@ gen_api_init_files(
api_name = "estimator",
output_files = ESTIMATOR_API_INIT_FILES,
package = "tensorflow.python.estimator",
+ package_dep = "//tensorflow/python/estimator:estimator_py",
)
diff --git a/tensorflow/python/estimator/keras.py b/tensorflow/python/estimator/keras.py
index 2f439f765e..312eb9a035 100644
--- a/tensorflow/python/estimator/keras.py
+++ b/tensorflow/python/estimator/keras.py
@@ -45,7 +45,6 @@ from tensorflow.python.saved_model import signature_constants
from tensorflow.python.training import distribute as distribute_lib
from tensorflow.python.training import saver as saver_lib
from tensorflow.python.training import training_util
-from tensorflow.python.util.tf_export import tf_export
_DEFAULT_SERVING_KEY = signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY
@@ -446,7 +445,6 @@ def _save_first_checkpoint(keras_model, estimator, custom_objects,
saver.save(sess, os.path.join(estimator.model_dir, 'keras_model.ckpt'))
-@tf_export('keras.estimator.model_to_estimator')
def model_to_estimator(keras_model=None,
keras_model_path=None,
custom_objects=None,
diff --git a/tensorflow/python/keras/BUILD b/tensorflow/python/keras/BUILD
index 151a26f6e6..bc33dddc95 100755
--- a/tensorflow/python/keras/BUILD
+++ b/tensorflow/python/keras/BUILD
@@ -39,6 +39,7 @@ py_library(
"datasets/imdb.py",
"datasets/mnist.py",
"datasets/reuters.py",
+ "estimator/__init__.py",
"preprocessing/__init__.py",
"preprocessing/image.py",
"preprocessing/sequence.py",
diff --git a/tensorflow/python/keras/__init__.py b/tensorflow/python/keras/__init__.py
index 3493069a5b..198c66d9e1 100644
--- a/tensorflow/python/keras/__init__.py
+++ b/tensorflow/python/keras/__init__.py
@@ -27,6 +27,7 @@ from tensorflow.python.keras import backend
from tensorflow.python.keras import callbacks
from tensorflow.python.keras import constraints
from tensorflow.python.keras import datasets
+from tensorflow.python.keras import estimator
from tensorflow.python.keras import initializers
from tensorflow.python.keras import layers
from tensorflow.python.keras import losses
diff --git a/tensorflow/python/keras/estimator/__init__.py b/tensorflow/python/keras/estimator/__init__.py
new file mode 100644
index 0000000000..cb86a69990
--- /dev/null
+++ b/tensorflow/python/keras/estimator/__init__.py
@@ -0,0 +1,46 @@
+# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+"""Keras estimator API."""
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
+from tensorflow.python.util.tf_export import tf_export
+
+# Keras has undeclared dependency on tensorflow/estimator:estimator_py.
+# As long as you depend //third_party/py/tensorflow:tensorflow target
+# everything will work as normal.
+
+try:
+ import tensorflow.python.estimator.keras as keras_lib # pylint: disable=g-import-not-at-top
+ model_to_estimator = tf_export('keras.estimator.model_to_estimator')(
+ keras_lib.model_to_estimator)
+except Exception: # pylint: disable=broad-except
+
+ # pylint: disable=unused-argument
+ def stub_model_to_estimator(keras_model=None,
+ keras_model_path=None,
+ custom_objects=None,
+ model_dir=None,
+ config=None):
+ raise NotImplementedError(
+ 'tf.keras.estimator.model_to_estimator function not available in your '
+ 'installation.')
+ # pylint: enable=unused-argument
+
+ model_to_estimator = tf_export('keras.estimator.model_to_estimator')(
+ stub_model_to_estimator)
+
diff --git a/tensorflow/tools/api/generator/BUILD b/tensorflow/tools/api/generator/BUILD
index 6065c12cad..8c760e6f52 100644
--- a/tensorflow/tools/api/generator/BUILD
+++ b/tensorflow/tools/api/generator/BUILD
@@ -3,38 +3,37 @@
licenses(["notice"]) # Apache 2.0
-exports_files(["LICENSE"])
-
load("//tensorflow/tools/api/generator:api_gen.bzl", "ESTIMATOR_API_INIT_FILES")
load("//tensorflow/tools/api/generator:api_gen.bzl", "TENSORFLOW_API_INIT_FILES")
-py_library(
- name = "doc_srcs",
- srcs = ["doc_srcs.py"],
- srcs_version = "PY2AND3",
- deps = [
- "//tensorflow/python:util",
+exports_files(
+ [
+ "LICENSE",
+ "create_python_api.py",
],
)
-py_binary(
- name = "create_python_api",
- srcs = ["create_python_api.py"],
+py_library(
+ name = "doc_srcs",
+ srcs = ["doc_srcs.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
- ":doc_srcs",
- "//tensorflow/python:no_contrib",
+ "//tensorflow/python:util",
],
)
py_test(
name = "create_python_api_test",
- srcs = ["create_python_api_test.py"],
+ srcs = [
+ "create_python_api.py",
+ "create_python_api_test.py",
+ ],
srcs_version = "PY2AND3",
deps = [
- ":create_python_api",
+ ":doc_srcs",
"//tensorflow/python:client_testlib",
+ "//tensorflow/python:no_contrib",
],
)
@@ -67,5 +66,6 @@ py_test(
":doc_srcs",
"//tensorflow/python:client_testlib",
"//tensorflow/python:no_contrib",
+ "//tensorflow/python/estimator:estimator_py",
],
)
diff --git a/tensorflow/tools/api/generator/api_gen.bzl b/tensorflow/tools/api/generator/api_gen.bzl
index b7ebcb976b..d746b5d3e4 100644
--- a/tensorflow/tools/api/generator/api_gen.bzl
+++ b/tensorflow/tools/api/generator/api_gen.bzl
@@ -118,24 +118,44 @@ ESTIMATOR_API_INIT_FILES = [
# template will be replaced with root imports collected by this genrule.
# srcs: genrule sources. If passing root_init_template, the template file
# must be included in sources.
+# api_name: Name of the project that you want to generate API files for
+# (e.g. "tensorflow" or "estimator").
+# package: Python package containing the @tf_export decorators you want to
+# process
+# package_dep: Python library target containing your package.
+
def gen_api_init_files(
name,
output_files = TENSORFLOW_API_INIT_FILES,
root_init_template = None,
srcs = [],
api_name = "tensorflow",
- package = "tensorflow.python"):
+ package = "tensorflow.python",
+ package_dep = "//tensorflow/python:no_contrib"):
root_init_template_flag = ""
if root_init_template:
- root_init_template_flag = "--root_init_template=$(location " + root_init_template + ")"
+ root_init_template_flag = "--root_init_template=$(location " + root_init_template + ")"
+
+ api_gen_binary_target = "create_" + package + "_api"
+ native.py_binary(
+ name = "create_" + package + "_api",
+ srcs = ["//tensorflow/tools/api/generator:create_python_api.py"],
+ main = "//tensorflow/tools/api/generator:create_python_api.py",
+ srcs_version = "PY2AND3",
+ visibility = ["//visibility:public"],
+ deps = [
+ package_dep,
+ "//tensorflow/tools/api/generator:doc_srcs",
+ ],
+ )
+
native.genrule(
name = name,
outs = output_files,
cmd = (
- "$(location //tensorflow/tools/api/generator:create_python_api) " +
- root_init_template_flag + " --apidir=$(@D) --apiname=" + api_name + " --package=" + package + " $(OUTS)"
- ),
+ "$(location :" + api_gen_binary_target + ") " +
+ root_init_template_flag + " --apidir=$(@D) --apiname=" + api_name + " --package=" + package + " $(OUTS)"),
srcs = srcs,
- tools = ["//tensorflow/tools/api/generator:create_python_api"],
+ tools = [":" + api_gen_binary_target ],
visibility = ["//tensorflow:__pkg__"],
)
diff --git a/tensorflow/tools/api/generator/doc_srcs.py b/tensorflow/tools/api/generator/doc_srcs.py
index ccd5bea481..ad1988494d 100644
--- a/tensorflow/tools/api/generator/doc_srcs.py
+++ b/tensorflow/tools/api/generator/doc_srcs.py
@@ -43,7 +43,7 @@ _TENSORFLOW_DOC_SOURCES = {
'gfile': DocSource(docstring_module_name='platform.gfile'),
'graph_util': DocSource(docstring_module_name='framework.graph_util'),
'image': DocSource(docstring_module_name='ops.image_ops'),
- 'keras.estimator': DocSource(docstring_module_name='estimator.keras'),
+ 'keras.estimator': DocSource(docstring_module_name='keras.estimator'),
'linalg': DocSource(docstring_module_name='ops.linalg_ops'),
'logging': DocSource(docstring_module_name='ops.logging_ops'),
'losses': DocSource(docstring_module_name='ops.losses.losses'),