aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/docs_src
diff options
context:
space:
mode:
authorGravatar Derek Murray <mrry@google.com>2018-08-20 08:31:10 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-20 08:34:48 -0700
commit16340f6efa529a85bf569efdba7ba63ac0085b67 (patch)
tree3619f7429c834f16c13d3fb2d8eed8c904e88eb2 /tensorflow/docs_src
parent9aab0861f45ae31850cc3d61cb48a628a9a809cc (diff)
[tf.data] Modernize description of using datasets with estimators.
PiperOrigin-RevId: 209422880
Diffstat (limited to 'tensorflow/docs_src')
-rw-r--r--tensorflow/docs_src/guide/datasets.md14
1 files changed, 7 insertions, 7 deletions
diff --git a/tensorflow/docs_src/guide/datasets.md b/tensorflow/docs_src/guide/datasets.md
index bf77550f6a..60de181b21 100644
--- a/tensorflow/docs_src/guide/datasets.md
+++ b/tensorflow/docs_src/guide/datasets.md
@@ -782,8 +782,9 @@ with tf.train.MonitoredTrainingSession(...) as sess:
sess.run(training_op)
```
-To use a `Dataset` in the `input_fn` of a `tf.estimator.Estimator`, we also
-recommend using `Dataset.make_one_shot_iterator()`. For example:
+To use a `Dataset` in the `input_fn` of a `tf.estimator.Estimator`, simply
+return the `Dataset` and the framework will take care of creating an iterator
+and initializing it for you. For example:
```python
def dataset_input_fn():
@@ -814,10 +815,9 @@ def dataset_input_fn():
dataset = dataset.shuffle(buffer_size=10000)
dataset = dataset.batch(32)
dataset = dataset.repeat(num_epochs)
- iterator = dataset.make_one_shot_iterator()
- # `features` is a dictionary in which each value is a batch of values for
- # that feature; `labels` is a batch of labels.
- features, labels = iterator.get_next()
- return features, labels
+ # Each element of `dataset` is tuple containing a dictionary of features
+ # (in which each value is a batch of values for that feature), and a batch of
+ # labels.
+ return dataset
```