Created
April 25, 2019 23:27
-
-
Save poweic/2a889de03b0a7f112d7fa8bc5e2143a9 to your computer and use it in GitHub Desktop.
Code snippet to recreate memory leak bug when .map is used with AUTOTUNE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import tensorflow as tf | |
zeros = [0] * 10 | |
dataset = ( | |
tf.data.Dataset.from_tensor_slices(zeros) | |
.map(lambda x: x, num_parallel_calls=tf.data.experimental.AUTOTUNE) | |
# .map(lambda x: x) | |
.batch(1) | |
) | |
for x in dataset: | |
input("Press Enter to continue...") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment