August 2019
Intermediate to advanced
202 pages
5h 9m
English
This transformation maps the map_func input across the input dataset and flattens the results. This is used to make sure that the order of your dataset remains the same. map_func must return a dataset here:
a = Dataset.from_tensor_slices([ [1, 2, 3], [4, 5, 6], [7, 8, 9] ])a.flat_map(lambda x: Dataset.from_tensor_slices(x + 1)) # ==># [ 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
Read now
Unlock full access