Skip to content

Instantly share code, notes, and snippets.

@optiluca
Created August 14, 2020 09:11
Show Gist options
  • Save optiluca/d84d169315035b8a1dadc97d52b88f24 to your computer and use it in GitHub Desktop.
Save optiluca/d84d169315035b8a1dadc97d52b88f24 to your computer and use it in GitHub Desktop.
import os
# os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import tensorflow as tf
root_dir = os.path.dirname(os.path.abspath(__file__))
os.makedirs('test_files', exist_ok=True)
for i_dummy_file in range(10):
f_name = os.path.join(root_dir, 'test_files', 'dummy_{}.tfrecord'.format(i_dummy_file))
if not os.path.exists(f_name):
with open(f_name, mode='a'):
pass
tfrecord_path = os.path.join(root_dir, 'test_files', 'dummy_*.tfrecord')
print('Nobody is shuffling')
tf.data.Dataset.list_files(tfrecord_path, shuffle=False)
print('Everybody is shuffling')
tf.data.Dataset.list_files(tfrecord_path, shuffle=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment