def stable_var(input_, mean=None, axes=[0]):
 if (mean is None):
  mean = tf.reduce_mean(input_, axes)
 res = tf.square((input_ - mean))
 max_sqr = tf.reduce_max(res, axes)
 res /= max_sqr
 res = tf.reduce_mean(res, axes)
 res *= max_sqr
 return res

def stable_var ( input_ , mean = None , axes = [ 0 ] ) : if ( mean is None ) : mean = tf . reduce_mean ( input_ , axes ) res = tf . square ( ( input_ - mean ) ) max_sqr = tf . reduce_max ( res , axes ) res /= max_sqr res = tf . reduce_mean ( res , axes ) res *= max_sqr return res
numerically more stable variance computation .