code: def spec_augment(
      x,
      resize_mode="PIL",
      max_time_warp=80,
      max_freq_width=27,
      n_freq_mask=2,
      max_time_width=100,
      n_time_mask=2,
      inplace=True,
      replace_with_zero=True,
  ):
      """spec agument
  
      apply random time warping and time/freq masking
      default setting is based on LD (Librispeech double) in Table 2
          https://arxiv.org/pdf/1904.08779.pdf
  
      :param numpy.ndarray x: (time, freq)
      :param str resize_mode: "PIL" (fast, nondifferentiable) or "sparse_image_warp"
          (slow, differentiable)
      :param int max_time_warp: maximum frames to warp the center frame in spectrogram (W)
      :param int freq_mask_width: maximum width of the random freq mask (F)
      :param int n_freq_mask: the number of the random freq mask (m_F)
      :param int time_mask_width: maximum width of the random time mask (T)
      :param int n_time_mask: the number of the random time mask (m_T)
      :param bool inplace: overwrite intermediate array
      :param bool replace_with_zero: pad zero on mask if true else use mean
      """
      assert isinstance(x, numpy.ndarray)
      assert x.ndim == 2
      x = time_warp(x, max_time_warp, inplace=inplace, mode=resize_mode)
      x = freq_mask(
          x,
          max_freq_width,
          n_freq_mask,
          inplace=inplace,
          replace_with_zero=replace_with_zero,
      )
      x = time_mask(
          x,
          max_time_width,
          n_time_mask,
          inplace=inplace,
          replace_with_zero=replace_with_zero,
      )
      return x
  
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 4 for calling a global function with example usage: spec_augment(x, resize_mode, max_time_warp, max_freq_width, n_freq_mask, max_time_width, n_time_mask, inplace, replace_with_zero) and returns: x