Skip to content

Commit

Permalink
Add weights norm summary
Browse files Browse the repository at this point in the history
  • Loading branch information
fvisin committed Feb 11, 2018
1 parent d79f70a commit db4abf5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main_loop_tf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,17 @@ def dev_extra_summaries(self, stacked_model_outs, stacked_loss_outs,
is_training, dev_stats_scope, phase_set_dev,
these_s):
"""Add user-defined per-device summaries"""
pass
with tf.name_scope(None):
for w in tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES):
if 'weights' in w.name:
# Remove the implicit name_scope of the variable scope
var_name = w.op.name.replace('model/', '')
scope_str, var_name = squash_maybe(phase_set_dev +
'weights_norms',
var_name, 1)
with tf.name_scope(scope_str + '/'):
tf.summary.scalar(var_name, tf.global_norm([w]),
these_s)

def extra_summaries(self, stacked_model_outs, stacked_loss_outs,
is_training, stats_scope, these_s):
Expand Down

0 comments on commit db4abf5

Please sign in to comment.