Skip to content

Commit c803290

Browse files
authored
update the calculation of num_batches_per_epoch
the number of batches per epoch also depends on the number of gpus. it should be `num_batches_per_epoch = (cifar10.NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN / FLAGS.batch_size / FLAGS.num_gpus)`
1 parent 82e783e commit c803290

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tutorials/image/cifar10/cifar10_multi_gpu_train.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def train():
147147

148148
# Calculate the learning rate schedule.
149149
num_batches_per_epoch = (cifar10.NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN /
150-
FLAGS.batch_size)
150+
FLAGS.batch_size / FLAGS.num_gpus)
151151
decay_steps = int(num_batches_per_epoch * cifar10.NUM_EPOCHS_PER_DECAY)
152152

153153
# Decay the learning rate exponentially based on the number of steps.

0 commit comments

Comments
 (0)