def _RunningAvgLoss(loss, running_avg_loss, summary_writer, step, decay=0.999):
 if (running_avg_loss == 0):
  running_avg_loss = loss
 else:
  running_avg_loss = ((running_avg_loss * decay) + ((1 - decay) * loss))
 running_avg_loss = min(running_avg_loss, 12)
 loss_sum = tf.Summary()
 loss_sum.value.add(tag='running_avg_loss', simple_value=running_avg_loss)
 summary_writer.add_summary(loss_sum, step)
 sys.stdout.write(('running_avg_loss: %f\n' % running_avg_loss))
 return running_avg_loss

def _RunningAvgLoss ( loss , running_avg_loss , summary_writer , step , decay = 0.999 ) : if ( running_avg_loss == 0 ) : running_avg_loss = loss else : running_avg_loss = ( ( running_avg_loss * decay ) + ( ( 1 - decay ) * loss ) ) running_avg_loss = min ( running_avg_loss , 12 ) loss_sum = tf . Summary ( ) loss_sum . value . add ( tag = 'running_avg_loss' , simple_value = running_avg_loss ) summary_writer . add_summary ( loss_sum , step ) sys . stdout . write ( ( 'running_avg_loss: %f\n' % running_avg_loss ) ) return running_avg_loss
calculate the running average of losses .