diff options
author | Moritz Kröger <moritz.kroeger@tu-dortmund.de> | 2018-09-18 21:14:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-18 21:14:23 +0200 |
commit | effced8f591441e0706377e2b31debb96ee9203d (patch) | |
tree | 021e396016b8258c89a4b725ec6ef091ba7f5e60 /tensorflow/python/data | |
parent | 9ac00398d1c0e5f3f2e76dec15fa6646f5027633 (diff) |
Moved example and changed wording
Diffstat (limited to 'tensorflow/python/data')
-rw-r--r-- | tensorflow/python/data/ops/dataset_ops.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tensorflow/python/data/ops/dataset_ops.py b/tensorflow/python/data/ops/dataset_ops.py index 2fc41a3b98..1b9ea2ed08 100644 --- a/tensorflow/python/data/ops/dataset_ops.py +++ b/tensorflow/python/data/ops/dataset_ops.py @@ -1009,11 +1009,8 @@ class Dataset(object): def flat_map(self, map_func): """Maps `map_func` across this dataset and flattens the result. - `tf.data.Dataset.interleave()` is a generalization of `flat_map`, since - `flat_map` produces a similar outputs as `tf.data.Dataset.interleave(cycle_length=1)` - Use `flat_map` if you want to make sure, that the order of your dataset stays the same. - For example, to implement unbatch: + For example, to flatten a dataset of batches into a dataset of their elements: ```python # NOTE: The following examples use `{ ... }` to represent the @@ -1023,6 +1020,10 @@ class Dataset(object): a.flat_map(lambda x: Dataset.from_tensor_slices(x)) == {[1,2,3,4,5,6,7,8,9,10]} ``` + + `tf.data.Dataset.interleave()` is a generalization of `flat_map`, since + `flat_map` produces the same output as `tf.data.Dataset.interleave(cycle_length=1)` + Args: map_func: A function mapping a nested structure of tensors (having shapes and types defined by `self.output_shapes` and `self.output_types`) to a |