Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion official/resnet/resnet_run_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,11 @@ def exclude_batch_norm(name):
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()
Expand Down