aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/util
diff options
context:
space:
mode:
authorGravatar Akshay Modi <nareshmodi@google.com>2018-09-07 16:26:31 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-07 16:31:53 -0700
commit39b2fb7cfef489424fead18ec5174d8e8b2a9a1a (patch)
tree679ebe2aa3dad3b47ae95f5a01ce5b6adf9b34d8 /tensorflow/python/util
parent204037cc5a623949a90a17cfd67eae42348ed87f (diff)
Remove unnecessary function calls from data/util/nest.py
PiperOrigin-RevId: 212054927
Diffstat (limited to 'tensorflow/python/util')
-rw-r--r--tensorflow/python/util/util.i27
1 files changed, 27 insertions, 0 deletions
diff --git a/tensorflow/python/util/util.i b/tensorflow/python/util/util.i
index 6d336ac39d..104a615636 100644
--- a/tensorflow/python/util/util.i
+++ b/tensorflow/python/util/util.i
@@ -104,9 +104,36 @@ Raises:
%unignore tensorflow::swig::Flatten;
%noexception tensorflow::swig::Flatten;
+%feature("docstring") tensorflow::swig::IsSequenceForData
+"""Returns a true if `seq` is a Sequence or dict (except strings/lists).
+
+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.
+"""
%unignore tensorflow::swig::IsSequenceForData;
%noexception tensorflow::swig::IsSequenceForData;
+%feature("docstring") tensorflow::swig::FlattenForData
+"""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.
+"""
%unignore tensorflow::swig::FlattenForData;
%noexception tensorflow::swig::FlattenForData;