def moving_av(total_loss):
 loss_averages = tf.train.ExponentialMovingAverage(0.9, name='avg')
 losses = tf.get_collection('losses')
 loss_averages_op = loss_averages.apply((losses + [total_loss]))
 return loss_averages_op

def moving_av ( total_loss ) : loss_averages = tf . train . ExponentialMovingAverage ( 0.9 , name = 'avg' ) losses = tf . get_collection ( 'losses' ) loss_averages_op = loss_averages . apply ( ( losses + [ total_loss ] ) ) return loss_averages_op
generates moving average for all losses args: total_loss: total loss from loss() .