[tf.data] Iterator and data/nest documentation fixes
PiperOrigin-RevId: 171165796
This commit is contained in:
parent
09fa4a4e35
commit
7e7d55c0f5
tensorflow/python/data
@ -138,21 +138,21 @@ class Iterator(object):
|
||||
This method allows you to define a "feedable" iterator where you can choose
|
||||
between concrete iterators by feeding a value in a @{tf.Session.run} call.
|
||||
In that case, `string_handle` would a @{tf.placeholder}, and you would feed
|
||||
it with the value of @{tf.contrib.data.Iterator.string_handle} in each step.
|
||||
it with the value of @{tf.data.Iterator.string_handle} in each step.
|
||||
|
||||
For example, if you had two iterators that marked the current position in
|
||||
a training dataset and a test dataset, you could choose which to use in
|
||||
each step as follows:
|
||||
|
||||
```python
|
||||
train_iterator = tf.contrib.data.Dataset(...).make_one_shot_iterator()
|
||||
train_iterator = tf.data.Dataset(...).make_one_shot_iterator()
|
||||
train_iterator_handle = sess.run(train_iterator.string_handle())
|
||||
|
||||
test_iterator = tf.contrib.data.Dataset(...).make_one_shot_iterator()
|
||||
test_iterator = tf.data.Dataset(...).make_one_shot_iterator()
|
||||
test_iterator_handle = sess.run(test_iterator.string_handle())
|
||||
|
||||
handle = tf.placeholder(tf.string, shape=[])
|
||||
iterator = tf.contrib.data.Iterator.from_string_handle(
|
||||
iterator = tf.data.Iterator.from_string_handle(
|
||||
handle, train_iterator.output_types)
|
||||
|
||||
next_element = iterator.get_next()
|
||||
|
@ -106,7 +106,7 @@ def is_sequence(seq):
|
||||
|
||||
NOTE(mrry): This differs from `tensorflow.python.util.nest.is_sequence()`,
|
||||
which *does* treat a Python list as a sequence. For ergonomic
|
||||
reasons, `tf.contrib.data` users would prefer to treat lists as
|
||||
reasons, `tf.data` users would prefer to treat lists as
|
||||
implict `tf.Tensor` objects, and dicts as (nested) sequences.
|
||||
|
||||
Args:
|
||||
|
Loading…
Reference in New Issue
Block a user