Commit 9aa390c7 authored by Yuxin Wu's avatar Yuxin Wu

add rms for param summary

parent 9319b978
...@@ -40,7 +40,7 @@ def add_param_summary(summary_lists): ...@@ -40,7 +40,7 @@ def add_param_summary(summary_lists):
Add summary for all trainable variables matching the regex Add summary for all trainable variables matching the regex
:param summary_lists: list of (regex, [list of action to perform]). :param summary_lists: list of (regex, [list of action to perform]).
Action can be 'mean', 'scalar', 'histogram', 'sparsity'. Action can be 'mean', 'scalar', 'histogram', 'sparsity', 'rms'
""" """
def perform(var, action): def perform(var, action):
ndim = var.get_shape().ndims ndim = var.get_shape().ndims
...@@ -59,6 +59,10 @@ def add_param_summary(summary_lists): ...@@ -59,6 +59,10 @@ def add_param_summary(summary_lists):
if action == 'mean': if action == 'mean':
tf.scalar_summary(name + '/mean', tf.reduce_mean(var)) tf.scalar_summary(name + '/mean', tf.reduce_mean(var))
return return
if action == 'rms':
tf.scalar_summary(name + '/rms',
tf.sqrt(tf.reduce_mean(tf.square(var))))
return
raise RuntimeError("Unknown action {}".format(action)) raise RuntimeError("Unknown action {}".format(action))
import re import re
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment