Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
elibixby committed Aug 22, 2017
1 parent 423fd77 commit 5cb2dbd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
22 changes: 10 additions & 12 deletions tutorials/image/cifar10_estimator/cifar10_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def _resnet_model_fn(features, labels, mode, params):
with tf.device(consolidation_device):
# Suggested learning rate scheduling from
# https://github.com/ppwwyyxx/tensorpack/blob/master/examples/ResNet/cifar10-resnet.py#L155
# users could apply other scheduling.
num_batches_per_epoch = cifar10.Cifar10DataSet.num_examples_per_epoch(
'train') // (params['train_batch_size'] * num_workers)
boundaries = [
Expand Down Expand Up @@ -485,13 +484,11 @@ def main(job_dir,
parser.add_argument(
'--num-intra-threads',
type=int,
default=1,
default=0,
help="""\
Number of threads to use for intra-op parallelism. If set to 0, the
system will pick an appropriate number. The default is 1 since in this
example CPU only handles the input pipeline and gradient aggregation
(when --is-cpu-ps). Ops that could potentially benefit from intra-op
parallelism are scheduled to run on GPUs.\
Number of threads to use for intra-op parallelism. When training on CPU
set to 0 to have the system pick the appropriate number or alternatively
set it to the number of physical CPU cores.\
"""
)
parser.add_argument(
Expand Down Expand Up @@ -525,15 +522,16 @@ def main(job_dir,

if args.num_gpus < 0:
raise ValueError(
'Invalid GPU count: \"num_gpus\" must be 0 or a positive integer.')
'Invalid GPU count: \"--num-gpus\" must be 0 or a positive integer.')
if args.num_gpus == 0 and args.variable_strategy == 'GPU':
raise ValueError(
'No GPU available for use, must use CPU to average gradients.')
'num-gpus=0, CPU must be used as parameter server. Set'
'--variable-strategy=CPU.')
if (args.num_layers - 2) % 6 != 0:
raise ValueError('Invalid num_layers parameter.')
raise ValueError('Invalid --num-layers parameter.')
if args.num_gpus != 0 and args.train_batch_size % args.num_gpus != 0:
raise ValueError('train_batch_size must be multiple of num_gpus.')
raise ValueError('--train-batch-size must be multiple of --num-gpus.')
if args.num_gpus != 0 and args.eval_batch_size % args.num_gpus != 0:
raise ValueError('eval_batch_size must be multiple of num_gpus.')
raise ValueError('--eval-batch-size must be multiple of --num-gpus.')

main(**vars(args))
3 changes: 3 additions & 0 deletions tutorials/image/cifar10_estimator/cifar10_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import collections
import six

import tensorflow as tf

from tensorflow.python.platform import tf_logging as logging

from tensorflow.core.framework import node_def_pb2
Expand Down

0 comments on commit 5cb2dbd

Please sign in to comment.