def moments_over_bl(x, x_mask):
  """Returns mean and var of x over B and L."""
  mean = reduce_mean_over_bl(x, x_mask)
  var = reduce_mean_over_bl((x-mean)**2, x_mask)
  return mean, var
Returns mean and var of x over B and L.
tensor2tensor/layers/transformer_glow_layers_ops.py