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
d0269919
Commit
d0269919
authored
Sep 06, 2017
by
Eli Bixby
Browse files
Move optimizer closer to usage
parent
534e86b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
tutorials/image/cifar10_estimator/cifar10_main.py
tutorials/image/cifar10_estimator/cifar10_main.py
+4
-3
No files found.
tutorials/image/cifar10_estimator/cifar10_main.py
View file @
d0269919
...
@@ -155,9 +155,6 @@ def get_model_fn(num_gpus, variable_strategy, num_workers):
...
@@ -155,9 +155,6 @@ def get_model_fn(num_gpus, variable_strategy, num_workers):
boundaries
,
staged_lr
)
boundaries
,
staged_lr
)
loss
=
tf
.
reduce_mean
(
tower_losses
,
name
=
'loss'
)
loss
=
tf
.
reduce_mean
(
tower_losses
,
name
=
'loss'
)
optimizer
=
tf
.
train
.
MomentumOptimizer
(
learning_rate
=
learning_rate
,
momentum
=
momentum
)
examples_sec_hook
=
cifar10_utils
.
ExamplesPerSecondHook
(
examples_sec_hook
=
cifar10_utils
.
ExamplesPerSecondHook
(
params
.
train_batch_size
,
every_n_steps
=
10
)
params
.
train_batch_size
,
every_n_steps
=
10
)
...
@@ -168,6 +165,10 @@ def get_model_fn(num_gpus, variable_strategy, num_workers):
...
@@ -168,6 +165,10 @@ def get_model_fn(num_gpus, variable_strategy, num_workers):
tensors
=
tensors_to_log
,
every_n_iter
=
100
)
tensors
=
tensors_to_log
,
every_n_iter
=
100
)
train_hooks
=
[
logging_hook
,
examples_sec_hook
]
train_hooks
=
[
logging_hook
,
examples_sec_hook
]
optimizer
=
tf
.
train
.
MomentumOptimizer
(
learning_rate
=
learning_rate
,
momentum
=
momentum
)
if
params
.
sync
:
if
params
.
sync
:
optimizer
=
tf
.
train
.
SyncReplicasOptimizer
(
optimizer
=
tf
.
train
.
SyncReplicasOptimizer
(
optimizer
,
replicas_to_aggregate
=
num_workers
)
optimizer
,
replicas_to_aggregate
=
num_workers
)
...
...
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