def standard_normal_density(x, x_mask, reduce_sum=False):
  """Return standard normal distribution with same shape as x."""
  log_probs = -0.5 * (x**2 + math.log(math.pi * 2.0))
  if reduce_sum:
    log_probs = reduce_mean_over_bl_sum_over_c(log_probs, x_mask)
  else:
    log_probs = reduce_sum_over_lc(log_probs, x_mask)
  return log_probs
Return standard normal distribution with same shape as x.
tensor2tensor/layers/transformer_glow_layers_ops.py