code: def time_mask(
      spec, T=40, n_mask=2, replace_with_zero=True, inplace=False
  ):
      """freq mask for spec agument
  
      :param numpy.ndarray spec: (time, freq)
      :param int n_mask: the number of masks
      :param bool inplace: overwrite
      :param bool replace_with_zero: pad zero on mask if true else use mean
      """
      if inplace and spec.flags.writeable:
          cloned = spec
      else:
          cloned = spec.copy()
      len_spectro = cloned.shape[0]
      ts = numpy.random.randint(0, T, size=(n_mask, 2))
      for t, mask_end in ts:
          # avoid randint range error
          if len_spectro - t <= 0:
              continue
          t_zero = random.randrange(0, len_spectro - t)
  
          # avoids randrange error if values are equal and range is empty
          if t_zero == t_zero + t:
              continue
  
          mask_end += t_zero
          if replace_with_zero:
              cloned[t_zero:mask_end] = 0
          else:
              cloned[t_zero:mask_end] = cloned.mean()
      return cloned
  
file_path: espnet/espnet/transform/spec_augment.py
imports: import random
  import numpy
  from espnet.transform.functional import FuncTrans
label_desc: Use image node_id 3 for calling a global function with example usage: time_mask(spec, T, n_mask, replace_with_zero, inplace) and returns: cloned