aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Geoffrey Irving <geoffreyi@google.com>2016-02-08 09:34:09 -0800
committerGravatar Vijay Vasudevan <vrv@google.com>2016-02-08 18:48:43 -0800
commitd797048c6e78d45b22bff31e96bfaaf36780087a (patch)
tree6e2759d37c34a30d59080b276bef946fc069a0e4
parent59f1eba5fb94506a205fa2e81145667754739da5 (diff)
Remove tf.tensor_util and change tf.unsupported to tf.contrib.util
tf.tensor_util was already not public (not documented), now it is not part of tf.__all__. The one function that was in tf.unsupported is now tf.contrib.util.constant_value, and there is also tf.contrib.util.make_tensor_proto. Change: 114118183
m---------google/protobuf0
-rw-r--r--tensorflow/contrib/BUILD1
-rw-r--r--tensorflow/contrib/__init__.py1
-rw-r--r--tensorflow/contrib/util/BUILD27
-rw-r--r--tensorflow/contrib/util/__init__.py (renamed from tensorflow/python/unsupported.py)15
-rw-r--r--tensorflow/python/BUILD1
-rw-r--r--tensorflow/python/__init__.py9
-rw-r--r--tensorflow/python/framework/gen_docs_combined.py4
-rw-r--r--tensorflow/python/framework/tensor_util_test.py24
-rw-r--r--tensorflow/python/kernel_tests/learn_test.py2
10 files changed, 50 insertions, 34 deletions
diff --git a/google/protobuf b/google/protobuf
-Subproject 0906f5d18a2548024b511eadcbb4cfc0ca56cd6
+Subproject bc215089ca7d9da3a2b313b250d1dee665eda43
diff --git a/tensorflow/contrib/BUILD b/tensorflow/contrib/BUILD
index 90cb650df0..c18a77484a 100644
--- a/tensorflow/contrib/BUILD
+++ b/tensorflow/contrib/BUILD
@@ -13,6 +13,7 @@ py_library(
srcs_version = "PY2AND3",
deps = [
"//tensorflow/contrib/layers:layers_py",
+ "//tensorflow/contrib/util:util_py",
],
)
diff --git a/tensorflow/contrib/__init__.py b/tensorflow/contrib/__init__.py
index 6ccf431465..99adabc478 100644
--- a/tensorflow/contrib/__init__.py
+++ b/tensorflow/contrib/__init__.py
@@ -21,3 +21,4 @@ from __future__ import print_function
# Add projects here, they will show up under tf.contrib.
from tensorflow.contrib import layers
+from tensorflow.contrib import util
diff --git a/tensorflow/contrib/util/BUILD b/tensorflow/contrib/util/BUILD
new file mode 100644
index 0000000000..6e517e117b
--- /dev/null
+++ b/tensorflow/contrib/util/BUILD
@@ -0,0 +1,27 @@
+# Description:
+# contains parts of TensorFlow that are experimental or unstable and which are not supported.
+
+licenses(["notice"]) # Apache 2.0
+
+exports_files(["LICENSE"])
+
+package(default_visibility = ["//tensorflow:__subpackages__"])
+
+py_library(
+ name = "util_py",
+ srcs = glob(["**/*.py"]),
+ srcs_version = "PY2AND3",
+ deps = [],
+)
+
+filegroup(
+ name = "all_files",
+ srcs = glob(
+ ["**/*"],
+ exclude = [
+ "**/METADATA",
+ "**/OWNERS",
+ ],
+ ),
+ visibility = ["//tensorflow:__subpackages__"],
+)
diff --git a/tensorflow/python/unsupported.py b/tensorflow/contrib/util/__init__.py
index 23c40766ab..8f6e1900cb 100644
--- a/tensorflow/python/unsupported.py
+++ b/tensorflow/contrib/util/__init__.py
@@ -13,22 +13,15 @@
# limitations under the License.
# ==============================================================================
-"""This module includes unsupported and experimental features which are exposed
-but not part of the supported public API. Anything in this module can change
-without notice, even across a patch release.
+"""contrib module containing volatile or experimental utility code."""
-## Utilities
-
-@@constant_value
-"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import tensorflow.python.platform
-from tensorflow.python.util.all_util import make_all
-
# pylint: disable=unused-import
from tensorflow.python.framework.tensor_util import constant_value
+from tensorflow.python.framework.tensor_util import make_tensor_proto
-__all__ = make_all(__name__)
+# TODO(irving): Use make_all here.
+__all__ = ['constant_value', 'make_tensor_proto']
diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD
index 44964dda60..979897c985 100644
--- a/tensorflow/python/BUILD
+++ b/tensorflow/python/BUILD
@@ -19,7 +19,6 @@ py_library(
name = "python",
srcs = [
"__init__.py",
- "unsupported.py",
],
srcs_version = "PY2AND3",
visibility = ["//tensorflow:__pkg__"],
diff --git a/tensorflow/python/__init__.py b/tensorflow/python/__init__.py
index 08c815a171..17a0e11bfe 100644
--- a/tensorflow/python/__init__.py
+++ b/tensorflow/python/__init__.py
@@ -67,7 +67,6 @@ from tensorflow.python.ops import nn
from tensorflow.python.ops import image_ops as image
from tensorflow.python.user_ops import user_ops
from tensorflow.python.util import compat
-from tensorflow.python import unsupported
# Import the names from python/training.py as train.Name.
from tensorflow.python.training import training as train
@@ -84,11 +83,9 @@ from tensorflow.python.platform import sysconfig
from tensorflow.python.platform import test
# Don't export modules except for the few we really want
-_whitelist = set([app, compat, contrib, errors, flags, image, learn, logging, nn,
- python_io, resource_loader, sysconfig, test, train,
- unsupported, user_ops])
-# TODO(b/25561952): tf.tensor_util is DEPRECATED. Please avoid.
-_whitelist.update([tensor_util]) # pylint: disable=undefined-variable
+_whitelist = set([app, compat, contrib, errors, flags, image, learn, logging,
+ nn, python_io, resource_loader, sysconfig, test, train,
+ user_ops])
__all__ = [name for name, x in locals().items() if not name.startswith('_') and
(not inspect.ismodule(x) or x in _whitelist)]
__all__.append('__version__')
diff --git a/tensorflow/python/framework/gen_docs_combined.py b/tensorflow/python/framework/gen_docs_combined.py
index c0f4de9d6f..3ade2abd05 100644
--- a/tensorflow/python/framework/gen_docs_combined.py
+++ b/tensorflow/python/framework/gen_docs_combined.py
@@ -50,8 +50,7 @@ def get_module_to_name():
tf.image: "tf.image",
tf.nn: "tf.nn",
tf.train: "tf.train",
- tf.python_io: "tf.python_io",
- tf.unsupported: "tf.unsupported",}
+ tf.python_io: "tf.python_io",}
def all_libraries(module_to_name, members, documented):
# A list of (filename, docs.Library) pairs representing the individual files
@@ -114,7 +113,6 @@ def all_libraries(module_to_name, members, documented):
"FeatureList", "FeatureLists",
"RankingExample", "SequenceExample"]),
library("script_ops", "Wraps python functions", prefix=PREFIX_TEXT),
- library("unsupported", "Unsupported", tf.unsupported),
]
_hidden_symbols = ["Event", "LogMessage", "Summary", "SessionLog", "xrange",
diff --git a/tensorflow/python/framework/tensor_util_test.py b/tensorflow/python/framework/tensor_util_test.py
index 7085f157b4..0204b1d742 100644
--- a/tensorflow/python/framework/tensor_util_test.py
+++ b/tensorflow/python/framework/tensor_util_test.py
@@ -366,68 +366,68 @@ class ConstantValueTest(tf.test.TestCase):
def testConstant(self):
np_val = np.random.rand(3, 4, 7).astype(np.float32)
tf_val = tf.constant(np_val)
- self.assertAllClose(np_val, tf.unsupported.constant_value(tf_val))
+ self.assertAllClose(np_val, tf.contrib.util.constant_value(tf_val))
np_val = np.random.rand(3, 0, 7).astype(np.float32)
tf_val = tf.constant(np_val)
- self.assertAllClose(np_val, tf.unsupported.constant_value(tf_val))
+ self.assertAllClose(np_val, tf.contrib.util.constant_value(tf_val))
def testUnknown(self):
tf_val = state_ops.variable_op(shape=[3, 4, 7], dtype=tf.float32)
- self.assertIs(None, tf.unsupported.constant_value(tf_val))
+ self.assertIs(None, tf.contrib.util.constant_value(tf_val))
def testShape(self):
np_val = np.array([1, 2, 3], dtype=np.int32)
tf_val = tf.shape(tf.constant(0.0, shape=[1, 2, 3]))
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertAllEqual(np_val, c_val)
self.assertEqual(np.int32, c_val.dtype)
def testSize(self):
tf_val = tf.size(tf.constant(0.0, shape=[1, 2, 3]))
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertEqual(6, c_val)
def testSizeOfScalar(self):
tf_val = tf.size(tf.constant(0.0))
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertEqual(1, c_val)
self.assertEqual(np.int32, type(c_val))
def testRank(self):
tf_val = tf.rank(tf.constant(0.0, shape=[1, 2, 3]))
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertEqual(3, c_val)
def testCast(self):
np_val = np.random.rand(3, 4, 7).astype(np.float32)
tf_val = tf.cast(tf.constant(np_val), tf.float64)
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertAllClose(np_val.astype(np.float64), c_val)
np_val = np.random.rand(3, 0, 7).astype(np.float32)
tf_val = tf.cast(tf.constant(np_val), tf.float64)
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertAllClose(np_val.astype(np.float64), c_val)
def testConcat(self):
np_val = np.random.rand(3, 4, 7).astype(np.float32)
tf_val = tf.concat(
0, [np_val[0:1, :, :], np_val[1:2, :, :], np_val[2:3, :, :]])
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertAllClose(np_val, c_val)
tf_val = tf.concat(
tf.placeholder(tf.int32),
[np_val[0, :, :], np_val[1, :, :], np_val[2, :, :]])
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertIs(None, c_val)
tf_val = tf.concat(
1,
[np_val[0, :, :], tf.placeholder(tf.float32),
np_val[2, :, :]])
- c_val = tf.unsupported.constant_value(tf_val)
+ c_val = tf.contrib.util.constant_value(tf_val)
self.assertIs(None, c_val)
diff --git a/tensorflow/python/kernel_tests/learn_test.py b/tensorflow/python/kernel_tests/learn_test.py
index 66350c4fb0..4ae0149348 100644
--- a/tensorflow/python/kernel_tests/learn_test.py
+++ b/tensorflow/python/kernel_tests/learn_test.py
@@ -30,7 +30,7 @@ import tensorflow as tf
def assert_summary_scope(regexp):
"""Assert that all generated summaries match regexp."""
for summary in tf.get_collection(tf.GraphKeys.SUMMARIES):
- tag = tf.unsupported.constant_value(summary.op.inputs[0])
+ tag = tf.contrib.util.constant_value(summary.op.inputs[0])
assert tag is not None, 'All summaries must have constant tags'
tag = str(tag)