if self.params.summary_verbosity >= 2:
// Histogram of log values of all non-zero gradients.
all_grads = []
for grad, var in avg_grads:
all_grads.append(tf.reshape(grad, [-1]))
grads = tf.abs(tf.concat(all_grads, 0))
// exclude grads with zero values.
indices_for_non_zero_grads = tf.where(tf.not_equal(grads, 0))
log_grads = tf.reshape(
tf.log(tf.gather(grads, indices_for_non_zero_grads)), [-1])
tf.summary.histogram("log_gradients", log_grads)
if self.params.summary_verbosity >= 3:
for grad, var in avg_grads: