From 16340f6efa529a85bf569efdba7ba63ac0085b67 Mon Sep 17 00:00:00 2001 From: Derek Murray Date: Mon, 20 Aug 2018 08:31:10 -0700 Subject: [tf.data] Modernize description of using datasets with estimators. PiperOrigin-RevId: 209422880 --- tensorflow/docs_src/guide/datasets.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tensorflow/docs_src') 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 ``` -- cgit v1.2.3