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
ddf382bb
Commit
ddf382bb
authored
Feb 16, 2018
by
Asim Shankar
Browse files
Respond to PR comments
parent
06dd5c7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
official/mnist/mnist_eager.py
official/mnist/mnist_eager.py
+6
-0
No files found.
official/mnist/mnist_eager.py
View file @
ddf382bb
...
...
@@ -61,6 +61,9 @@ def train(model, optimizer, dataset, log_interval=None):
start
=
time
.
time
()
for
(
batch
,
(
images
,
labels
))
in
enumerate
(
tfe
.
Iterator
(
dataset
)):
with
tf
.
contrib
.
summary
.
record_summaries_every_n_global_steps
(
10
):
# Record the operations used to compute the loss given the input,
# so that the gradient of the loss with respect to the variables
# can be computed.
with
tfe
.
GradientTape
()
as
tape
:
logits
=
model
(
images
,
training
=
True
)
loss_value
=
loss
(
logits
,
labels
)
...
...
@@ -111,6 +114,9 @@ def main(_):
optimizer
=
tf
.
train
.
MomentumOptimizer
(
FLAGS
.
lr
,
FLAGS
.
momentum
)
if
FLAGS
.
output_dir
:
# Create directories to which summaries will be written
# tensorboard --logdir=<output_dir>
# can then be used to see the recorded summaries.
train_dir
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
'train'
)
test_dir
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
'eval'
)
tf
.
gfile
.
MakeDirs
(
FLAGS
.
output_dir
)
...
...
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