Skip to content

Commit 781cf3e

Browse files
committed
Add explanation for cycle_length
1 parent afe0c64 commit 781cf3e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

official/resnet/imagenet_main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,11 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1):
174174
# Shuffle the input files
175175
dataset = dataset.shuffle(buffer_size=_NUM_TRAIN_FILES)
176176

177-
# Convert to individual records
178-
# TODO(guptapriya): Should we make this cycle_length a flag similar to
179-
# num_parallel_calls?
177+
# Convert to individual records.
178+
# cycle_length = 10 means 10 files will be read and deserialized in parallel.
179+
# This number is low enough to not cause too much contention on small systems
180+
# but high enough to provide the benefits of parallelization. You may want
181+
# to increase this number if you have a large number of CPU cores.
180182
dataset = dataset.apply(tf.contrib.data.parallel_interleave(
181183
tf.data.TFRecordDataset, cycle_length=10))
182184

0 commit comments

Comments
 (0)