def log_norm(expr_list, name):
"""
:param expr_list:
:param name:
:return:
"""
n_elems = 0
norm = 0.
for e in nest.flatten(expr_list):
n_elems += tf.reduce_prod(tf.shape(e))
norm += tf.reduce_sum(e**2)
norm /= tf.to_float(n_elems)
tf.summary.scalar(name, norm)
return norm
评论列表
文章目录