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
d821ab89
Commit
d821ab89
authored
Mar 21, 2018
by
Neal Wu
Browse files
Add a tf.summary.scalar call for L2 loss in resnet
parent
4b85dab1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
official/resnet/resnet_run_loop.py
official/resnet/resnet_run_loop.py
+3
-1
No files found.
official/resnet/resnet_run_loop.py
View file @
d821ab89
...
...
@@ -235,9 +235,11 @@ def resnet_model_fn(features, labels, mode, model_class,
loss_filter_fn
=
loss_filter_fn
or
exclude_batch_norm
# Add weight decay to the loss.
loss
=
cross_entropy
+
weight_decay
*
tf
.
add_n
(
l2_
loss
=
weight_decay
*
tf
.
add_n
(
[
tf
.
nn
.
l2_loss
(
v
)
for
v
in
tf
.
trainable_variables
()
if
loss_filter_fn
(
v
.
name
)])
tf
.
summary
.
scalar
(
'l2_loss'
,
l2_loss
)
loss
=
cross_entropy
+
l2_loss
if
mode
==
tf
.
estimator
.
ModeKeys
.
TRAIN
:
global_step
=
tf
.
train
.
get_or_create_global_step
()
...
...
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