From f9ecca304d862fc4854b99b7cb2ee5d37d9f650d Mon Sep 17 00:00:00 2001 From: Anna R Date: Mon, 29 Oct 2018 15:52:53 -0700 Subject: [PATCH] Automated rollback of commit fbd12e7e7b3c340ed82171610e40f063ef70ad26 PiperOrigin-RevId: 219208174 --- .../lite/python/convert_saved_model_test.py | 2 +- .../contrib/timeseries/examples/lstm_test.py | 2 +- .../timeseries/python/timeseries/ar_model.py | 2 +- .../python/timeseries/ar_model_test.py | 2 +- .../python/timeseries/estimators.py | 2 +- .../python/timeseries/estimators_test.py | 2 +- .../timeseries/python/timeseries/head.py | 2 +- .../timeseries/python/timeseries/head_test.py | 2 +- .../python/timeseries/input_pipeline.py | 6 ++-- .../python/timeseries/state_management.py | 2 +- .../timeseries/state_management_test.py | 2 +- .../state_space_models/state_space_model.py | 2 +- .../state_space_model_test.py | 2 +- .../structural_ensemble_test.py | 2 +- .../state_space_models/varma_test.py | 2 +- .../python/timeseries/test_utils.py | 2 +- tensorflow/python/estimator/BUILD | 5 ++- tensorflow/python/estimator/estimator_lib.py | 34 +++++++++++++++++++ 18 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 tensorflow/python/estimator/estimator_lib.py diff --git a/tensorflow/contrib/lite/python/convert_saved_model_test.py b/tensorflow/contrib/lite/python/convert_saved_model_test.py index 29b48e11abd..fd81ac7f388 100644 --- a/tensorflow/contrib/lite/python/convert_saved_model_test.py +++ b/tensorflow/contrib/lite/python/convert_saved_model_test.py @@ -25,9 +25,9 @@ from __future__ import print_function import os from tensorflow.contrib.lite.python import convert_saved_model -from tensorflow.python import estimator from tensorflow.python import keras from tensorflow.python.client import session +from tensorflow.python.estimator import estimator_lib as estimator from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape diff --git a/tensorflow/contrib/timeseries/examples/lstm_test.py b/tensorflow/contrib/timeseries/examples/lstm_test.py index b4e36800d38..c58e24e6d97 100644 --- a/tensorflow/contrib/timeseries/examples/lstm_test.py +++ b/tensorflow/contrib/timeseries/examples/lstm_test.py @@ -20,7 +20,7 @@ from __future__ import print_function from tensorflow.contrib.timeseries.examples import lstm -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.platform import test diff --git a/tensorflow/contrib/timeseries/python/timeseries/ar_model.py b/tensorflow/contrib/timeseries/python/timeseries/ar_model.py index f2d3c0b20fb..bcadf4094e1 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/ar_model.py +++ b/tensorflow/contrib/timeseries/python/timeseries/ar_model.py @@ -26,7 +26,7 @@ from tensorflow.contrib.timeseries.python.timeseries import model_utils from tensorflow.contrib.timeseries.python.timeseries.feature_keys import PredictionFeatures from tensorflow.contrib.timeseries.python.timeseries.feature_keys import TrainEvalFeatures -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/timeseries/python/timeseries/ar_model_test.py b/tensorflow/contrib/timeseries/python/timeseries/ar_model_test.py index dd066721246..de547f835d3 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/ar_model_test.py +++ b/tensorflow/contrib/timeseries/python/timeseries/ar_model_test.py @@ -29,8 +29,8 @@ from tensorflow.contrib.timeseries.python.timeseries.estimators import ARRegress from tensorflow.contrib.timeseries.python.timeseries.feature_keys import PredictionFeatures from tensorflow.contrib.timeseries.python.timeseries.feature_keys import TrainEvalFeatures -from tensorflow.python import estimator as estimator_lib from tensorflow.python.client import session +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorflow.python.ops import variable_scope diff --git a/tensorflow/contrib/timeseries/python/timeseries/estimators.py b/tensorflow/contrib/timeseries/python/timeseries/estimators.py index d37ec9b3bc7..af68aa03cf6 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/estimators.py +++ b/tensorflow/contrib/timeseries/python/timeseries/estimators.py @@ -29,7 +29,7 @@ from tensorflow.contrib.timeseries.python.timeseries.state_space_models import s from tensorflow.contrib.timeseries.python.timeseries.state_space_models import structural_ensemble from tensorflow.contrib.timeseries.python.timeseries.state_space_models.filtering_postprocessor import StateInterpolatingAnomalyDetector -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.estimator.canned import optimizers from tensorflow.python.estimator.export import export_lib from tensorflow.python.feature_column import feature_column diff --git a/tensorflow/contrib/timeseries/python/timeseries/estimators_test.py b/tensorflow/contrib/timeseries/python/timeseries/estimators_test.py index 5a9f5b09bb8..ffd838be40e 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/estimators_test.py +++ b/tensorflow/contrib/timeseries/python/timeseries/estimators_test.py @@ -28,8 +28,8 @@ from tensorflow.contrib.timeseries.python.timeseries import feature_keys from tensorflow.contrib.timeseries.python.timeseries import input_pipeline from tensorflow.contrib.timeseries.python.timeseries import saved_model_utils -from tensorflow.python import estimator as estimator_lib from tensorflow.python.client import session +from tensorflow.python.estimator import estimator_lib from tensorflow.python.feature_column import feature_column from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/timeseries/python/timeseries/head.py b/tensorflow/contrib/timeseries/python/timeseries/head.py index ed2419513ae..1f9f9b7aa68 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/head.py +++ b/tensorflow/contrib/timeseries/python/timeseries/head.py @@ -20,7 +20,7 @@ from __future__ import print_function import re from tensorflow.contrib.timeseries.python.timeseries import feature_keys -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.estimator.canned import head as head_lib from tensorflow.python.estimator.canned import metric_keys from tensorflow.python.estimator.export import export_lib diff --git a/tensorflow/contrib/timeseries/python/timeseries/head_test.py b/tensorflow/contrib/timeseries/python/timeseries/head_test.py index ea4bfddc132..90c7d8ac1a9 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/head_test.py +++ b/tensorflow/contrib/timeseries/python/timeseries/head_test.py @@ -36,8 +36,8 @@ from tensorflow.contrib.timeseries.python.timeseries import model from tensorflow.contrib.timeseries.python.timeseries import state_management from tensorflow.core.example import example_pb2 -from tensorflow.python import estimator as estimator_lib from tensorflow.python.client import session as session_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.feature_column import feature_column from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py b/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py index f921f3366a1..403c6e2cb4a 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py +++ b/tensorflow/contrib/timeseries/python/timeseries/input_pipeline.py @@ -78,7 +78,7 @@ import numpy from tensorflow.contrib.timeseries.python.timeseries import feature_keys from tensorflow.contrib.timeseries.python.timeseries import model_utils -from tensorflow.python.estimator.inputs import numpy_io +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops @@ -256,7 +256,7 @@ class NumpyReader(TimeSeriesReader): # Remove the batch dimension from all features features = {key: numpy.squeeze(value, axis=0) for key, value in self._features.items()} - return numpy_io.numpy_input_fn( + return estimator_lib.inputs.numpy_input_fn( x=features, # The first dimensions of features are the series length, since we have # removed the batch dimension above. We now pull out @@ -268,7 +268,7 @@ class NumpyReader(TimeSeriesReader): def read_full(self): """Returns `Tensor` versions of the full Numpy arrays.""" - features = numpy_io.numpy_input_fn( + features = estimator_lib.inputs.numpy_input_fn( x=self._features, batch_size=1, num_epochs=None, diff --git a/tensorflow/contrib/timeseries/python/timeseries/state_management.py b/tensorflow/contrib/timeseries/python/timeseries/state_management.py index 5c23fbd5c6c..138406c6168 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/state_management.py +++ b/tensorflow/contrib/timeseries/python/timeseries/state_management.py @@ -24,7 +24,7 @@ from tensorflow.contrib.timeseries.python.timeseries import feature_keys from tensorflow.contrib.timeseries.python.timeseries import math_utils from tensorflow.contrib.timeseries.python.timeseries.model import ModelOutputs -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops diff --git a/tensorflow/contrib/timeseries/python/timeseries/state_management_test.py b/tensorflow/contrib/timeseries/python/timeseries/state_management_test.py index 7aad88d4ad3..42ba6e1c256 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/state_management_test.py +++ b/tensorflow/contrib/timeseries/python/timeseries/state_management_test.py @@ -27,7 +27,7 @@ from tensorflow.contrib.timeseries.python.timeseries import model from tensorflow.contrib.timeseries.python.timeseries import state_management from tensorflow.contrib.timeseries.python.timeseries import test_utils -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py index 293f66732a4..2ecc7eafdaf 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py +++ b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py @@ -31,7 +31,7 @@ from tensorflow.contrib.timeseries.python.timeseries import model_utils from tensorflow.contrib.timeseries.python.timeseries.feature_keys import TrainEvalFeatures from tensorflow.contrib.timeseries.python.timeseries.state_space_models import kalman_filter -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model_test.py b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model_test.py index 82f8056be93..26857ba235e 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model_test.py +++ b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model_test.py @@ -33,7 +33,7 @@ from tensorflow.contrib.timeseries.python.timeseries import state_management from tensorflow.contrib.timeseries.python.timeseries import test_utils from tensorflow.contrib.timeseries.python.timeseries.state_space_models import state_space_model -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/structural_ensemble_test.py b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/structural_ensemble_test.py index f60302704a3..a5f6a5341e8 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/structural_ensemble_test.py +++ b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/structural_ensemble_test.py @@ -29,7 +29,7 @@ from tensorflow.contrib.timeseries.python.timeseries.feature_keys import TrainEv from tensorflow.contrib.timeseries.python.timeseries.state_space_models import state_space_model from tensorflow.contrib.timeseries.python.timeseries.state_space_models import structural_ensemble -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import dtypes from tensorflow.python.platform import test diff --git a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/varma_test.py b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/varma_test.py index 3d45b0a31a2..e8875f4eb9f 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/varma_test.py +++ b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/varma_test.py @@ -25,7 +25,7 @@ from tensorflow.contrib.timeseries.python.timeseries.feature_keys import TrainEv from tensorflow.contrib.timeseries.python.timeseries.state_space_models import state_space_model from tensorflow.contrib.timeseries.python.timeseries.state_space_models import varma -from tensorflow.python import estimator as estimator_lib +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import constant_op from tensorflow.python.ops import variable_scope from tensorflow.python.ops import variables diff --git a/tensorflow/contrib/timeseries/python/timeseries/test_utils.py b/tensorflow/contrib/timeseries/python/timeseries/test_utils.py index c0e82d6e91b..ed02960faef 100644 --- a/tensorflow/contrib/timeseries/python/timeseries/test_utils.py +++ b/tensorflow/contrib/timeseries/python/timeseries/test_utils.py @@ -23,8 +23,8 @@ from tensorflow.contrib.timeseries.python.timeseries import input_pipeline from tensorflow.contrib.timeseries.python.timeseries import state_management from tensorflow.contrib.timeseries.python.timeseries.feature_keys import TrainEvalFeatures -from tensorflow.python import estimator as estimator_lib from tensorflow.python.client import session +from tensorflow.python.estimator import estimator_lib from tensorflow.python.framework import ops from tensorflow.python.framework import random_seed from tensorflow.python.ops import array_ops diff --git a/tensorflow/python/estimator/BUILD b/tensorflow/python/estimator/BUILD index 294e79dce0e..7363a112af8 100644 --- a/tensorflow/python/estimator/BUILD +++ b/tensorflow/python/estimator/BUILD @@ -4,7 +4,10 @@ licenses(["notice"]) # Apache 2.0 py_library( name = "estimator_py", - srcs = ["__init__.py"], + srcs = [ + "__init__.py", + "estimator_lib.py", + ], srcs_version = "PY2AND3", visibility = [ "//tensorflow:__pkg__", diff --git a/tensorflow/python/estimator/estimator_lib.py b/tensorflow/python/estimator/estimator_lib.py new file mode 100644 index 00000000000..4c18b552366 --- /dev/null +++ b/tensorflow/python/estimator/estimator_lib.py @@ -0,0 +1,34 @@ +# 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. +# ============================================================================== +"""estimator_lib python module. + +Importing from tensorflow.python.estimator is unsupported +and will soon break! +""" +# pylint: disable=unused-import,g-bad-import-order,g-import-not-at-top,wildcard-import + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from tensorflow_estimator.python.estimator import estimator_lib + +# Include attrs that start with single underscore. +_HAS_DYNAMIC_ATTRIBUTES = True +estimator_lib.__all__ = [ + s for s in dir(estimator_lib) if not s.startswith('__') +] + +from tensorflow_estimator.python.estimator.estimator_lib import *