class_docstr: Compute and apply CMVN to features.
class_docstr_tok: ["Compute","and","apply","CMVN","to","features","."]
docstr: Do CMVN.
  :param stats: Statistics of features.
  :return: Mean and std of features.
docstr_tok: ["Do","CMVN",".",":","param","stats",":","Statistics","of","features",".",":","return",":","Mean","and","std","of","features","."]
code: def call(self, stats):
      """
      Do CMVN.
      :param stats: Statistics of features.
      :return: Mean and std of features.
      """
      p = self.config
  
      if isinstance(stats, dict):
          stats_dict = dict(stats)
      else:
          if p.filetype == "mat":
              stats_dict = {None: kaldiio.load_mat(stats)}
          elif p.filetype == "ark":
              stats_dict = dict(kaldiio.load_ark(stats))
          else:
              raise ValueError(
                  "Not supporting filetype={}".format(p.filetype)
              )
  
      if p.utt2spk is not None:
          self.utt2spk = {}
          with io.open(p.utt2spk, "r", encoding="utf-8") as f:
              for line in f:
                  utt, spk = line.rstrip().split(None, 1)
                  self.utt2spk[utt] = spk
  
      elif p.spk2utt is not None:
          self.utt2spk = {}
          with io.open(p.spk2utt, "r", encoding="utf-8") as f:
              for line in f:
                  spk, utts = line.rstrip().split(None, 1)
                  for utt in utts.split():
                      self.utt2spk[utt] = spk
      else:
          self.utt2spk = None
  
      self.bias = {}
      self.scale = {}
      for spk, stats in stats_dict.items():
          assert len(stats) == 2, stats.shape
  
          count = stats[0, -1]
  
          if not (
              np.isscalar(count) or isinstance(count, (int, float))
          ):
              count = count.flatten()[0]
  
          mean = stats[0, :-1] / count
          var = stats[1, :-1] / count - mean * mean
          std = np.maximum(np.sqrt(var), p.std_floor)
          self.bias[spk] = -mean
          self.scale[spk] = 1 / std
  
file_path: delta/delta/data/frontend/cmvn.py
imports: import io
  import kaldiio
  import numpy
  from delta.utils.hparam import HParams
  from delta.data.frontend.base_frontend import BaseFrontend
label_desc: Use image node_id 3 for calling the CMVN obj's underlying member method code with example usage: obj.call(stats) without return types