def normalize(smpl_mat, rms):
  """Normalize with the given running averages of mean value & standard deviation.

  Args:
  * smpl_mat: unnormalized sample matrix
  * rms: running averages of mean value & standard deviation

  Returns:
  * samp_mat: normalized sample matrix
  """

  return smpl_mat if rms is None else (smpl_mat - rms.mean) / rms.std