From 424662da7d9d81e6f4af634424b4b4a8d788e4e8 Mon Sep 17 00:00:00 2001 From: Jonathan Hseu Date: Thu, 16 Mar 2017 11:57:40 -0800 Subject: Fix estimator tests when running against the installed pip package. This change allows the importing from tensorflow.python.estimator.* for usage in tests. Change: 150356830 --- tensorflow/python/__init__.py | 2 +- tensorflow/python/estimator/BUILD | 2 +- tensorflow/python/estimator/__init__.py | 42 -------------------------- tensorflow/python/estimator/estimator_lib.py | 44 ++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 44 deletions(-) create mode 100644 tensorflow/python/estimator/estimator_lib.py diff --git a/tensorflow/python/__init__.py b/tensorflow/python/__init__.py index 16a1b5d64d..e632091094 100644 --- a/tensorflow/python/__init__.py +++ b/tensorflow/python/__init__.py @@ -74,7 +74,7 @@ from tensorflow.python.ops.standard_ops import * # pylint: enable=wildcard-import # Bring in subpackages. -from tensorflow.python import estimator +from tensorflow.python.estimator import estimator_lib as estimator from tensorflow.python.layers import layers from tensorflow.python.ops import image_ops as image from tensorflow.python.ops import metrics diff --git a/tensorflow/python/estimator/BUILD b/tensorflow/python/estimator/BUILD index b20f1da810..36103f13bc 100644 --- a/tensorflow/python/estimator/BUILD +++ b/tensorflow/python/estimator/BUILD @@ -14,7 +14,7 @@ load("//tensorflow:tensorflow.bzl", "py_test") py_library( name = "estimator_py", - srcs = ["__init__.py"], + srcs = ["estimator_lib.py"], srcs_version = "PY2AND3", deps = [ ":checkpoint_utils", diff --git a/tensorflow/python/estimator/__init__.py b/tensorflow/python/estimator/__init__.py index 384f3d3a8a..e69de29bb2 100644 --- a/tensorflow/python/estimator/__init__.py +++ b/tensorflow/python/estimator/__init__.py @@ -1,42 +0,0 @@ -# Copyright 2017 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. -# ============================================================================== -"""Estimator: High level tools for working with models.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from tensorflow.python.estimator import export -from tensorflow.python.estimator import inputs - -from tensorflow.python.estimator.estimator import Estimator - -from tensorflow.python.estimator.model_fn import EstimatorSpec -from tensorflow.python.estimator.model_fn import ModeKeys - -from tensorflow.python.estimator.run_config import RunConfig - -from tensorflow.python.util.all_util import remove_undocumented - -_allowed_symbols = [ - 'inputs', - 'export', - 'Estimator', - 'EstimatorSpec', - 'ModeKeys', - 'RunConfig', -] - -remove_undocumented(__name__, allowed_exception_list=_allowed_symbols) diff --git a/tensorflow/python/estimator/estimator_lib.py b/tensorflow/python/estimator/estimator_lib.py new file mode 100644 index 0000000000..155bfa460c --- /dev/null +++ b/tensorflow/python/estimator/estimator_lib.py @@ -0,0 +1,44 @@ +# Copyright 2017 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. +# ============================================================================== +"""Estimator: High level tools for working with models.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +# pylint: disable=unused-import,line-too-long +from tensorflow.python.estimator import export +from tensorflow.python.estimator import inputs + +from tensorflow.python.estimator.estimator import Estimator + +from tensorflow.python.estimator.model_fn import EstimatorSpec +from tensorflow.python.estimator.model_fn import ModeKeys + +from tensorflow.python.estimator.run_config import RunConfig + +from tensorflow.python.util.all_util import remove_undocumented +# pylint: enable=unused-import,line-too-long + +_allowed_symbols = [ + 'inputs', + 'export', + 'Estimator', + 'EstimatorSpec', + 'ModeKeys', + 'RunConfig', +] + +remove_undocumented(__name__, allowed_exception_list=_allowed_symbols) -- cgit v1.2.3