Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
5cb2dbde
Commit
5cb2dbde
authored
Aug 22, 2017
by
Eli Bixby
Browse files
Fix review comments
parent
423fd778
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
tutorials/image/cifar10_estimator/cifar10_main.py
tutorials/image/cifar10_estimator/cifar10_main.py
+10
-12
tutorials/image/cifar10_estimator/cifar10_utils.py
tutorials/image/cifar10_estimator/cifar10_utils.py
+3
-0
No files found.
tutorials/image/cifar10_estimator/cifar10_main.py
View file @
5cb2dbde
...
@@ -143,7 +143,6 @@ def get_model_fn(num_gpus, variable_strategy, num_workers):
...
@@ -143,7 +143,6 @@ def get_model_fn(num_gpus, variable_strategy, num_workers):
with
tf
.
device
(
consolidation_device
):
with
tf
.
device
(
consolidation_device
):
# Suggested learning rate scheduling from
# Suggested learning rate scheduling from
# https://github.com/ppwwyyxx/tensorpack/blob/master/examples/ResNet/cifar10-resnet.py#L155
# 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
(
num_batches_per_epoch
=
cifar10
.
Cifar10DataSet
.
num_examples_per_epoch
(
'train'
)
//
(
params
[
'train_batch_size'
]
*
num_workers
)
'train'
)
//
(
params
[
'train_batch_size'
]
*
num_workers
)
boundaries
=
[
boundaries
=
[
...
@@ -485,13 +484,11 @@ if __name__ == '__main__':
...
@@ -485,13 +484,11 @@ if __name__ == '__main__':
parser
.
add_argument
(
parser
.
add_argument
(
'--num-intra-threads'
,
'--num-intra-threads'
,
type
=
int
,
type
=
int
,
default
=
1
,
default
=
0
,
help
=
"""
\
help
=
"""
\
Number of threads to use for intra-op parallelism. If set to 0, the
Number of threads to use for intra-op parallelism. When training on CPU
system will pick an appropriate number. The default is 1 since in this
set to 0 to have the system pick the appropriate number or alternatively
example CPU only handles the input pipeline and gradient aggregation
set it to the number of physical CPU cores.
\
(when --is-cpu-ps). Ops that could potentially benefit from intra-op
parallelism are scheduled to run on GPUs.
\
"""
"""
)
)
parser
.
add_argument
(
parser
.
add_argument
(
...
@@ -525,15 +522,16 @@ if __name__ == '__main__':
...
@@ -525,15 +522,16 @@ if __name__ == '__main__':
if
args
.
num_gpus
<
0
:
if
args
.
num_gpus
<
0
:
raise
ValueError
(
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'
:
if
args
.
num_gpus
==
0
and
args
.
variable_strategy
==
'GPU'
:
raise
ValueError
(
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
:
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
:
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
:
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
))
main
(
**
vars
(
args
))
tutorials/image/cifar10_estimator/cifar10_utils.py
View file @
5cb2dbde
import
collections
import
six
import
six
import
tensorflow
as
tf
from
tensorflow.python.platform
import
tf_logging
as
logging
from
tensorflow.python.platform
import
tf_logging
as
logging
from
tensorflow.core.framework
import
node_def_pb2
from
tensorflow.core.framework
import
node_def_pb2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment