aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/data
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-09-11 17:12:11 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-11 17:19:51 -0700
commited7ae86228c58e0a32f0dc21aedc9dad62db97c7 (patch)
tree48177388b001ef2f817606766bcd73aff4fda4a8 /tensorflow/python/data
parent7ac29a47561493a7f775cea5b03fe7284f1fa1b7 (diff)
Automated rollback of commit d31f360e1574553ed23b8d483512a2065ac426eb
PiperOrigin-RevId: 212551965
Diffstat (limited to 'tensorflow/python/data')
-rw-r--r--tensorflow/python/data/util/nest.py34
1 files changed, 4 insertions, 30 deletions
diff --git a/tensorflow/python/data/util/nest.py b/tensorflow/python/data/util/nest.py
index 9d621fcd30..e5abc654da 100644
--- a/tensorflow/python/data/util/nest.py
+++ b/tensorflow/python/data/util/nest.py
@@ -96,37 +96,11 @@ def _yield_value(iterable):
yield value
-def is_sequence(seq):
- """Returns a true if `seq` is a Sequence or dict (except strings/lists).
+# See the swig file (../../util/util.i) for documentation.
+is_sequence = _pywrap_tensorflow.IsSequenceForData
- NOTE(mrry): This differs from `tensorflow.python.util.nest.is_sequence()`,
- which *does* treat a Python list as a sequence. For ergonomic
- reasons, `tf.data` users would prefer to treat lists as
- implicit `tf.Tensor` objects, and dicts as (nested) sequences.
-
- Args:
- seq: an input sequence.
-
- Returns:
- True if the sequence is a not a string or list and is a
- collections.Sequence.
- """
- return _pywrap_tensorflow.IsSequenceForData(seq)
-
-
-def flatten(nest):
- """Returns a flat sequence from a given nested structure.
-
- If `nest` is not a sequence, this returns a single-element list: `[nest]`.
-
- Args:
- nest: an arbitrarily nested structure or a scalar object.
- Note, numpy arrays are considered scalars.
-
- Returns:
- A Python list, the flattened version of the input.
- """
- return _pywrap_tensorflow.FlattenForData(nest)
+# See the swig file (../../util/util.i) for documentation.
+flatten = _pywrap_tensorflow.FlattenForData
def assert_same_structure(nest1, nest2, check_types=True):