class_docstr: SpecAugment (https://arxiv.org/abs/1904.08779)
class_docstr_tok: ["SpecAugment","(","https",":","\/\/arxiv.org\/abs\/1904.08779",")"]
code: def __init__(
      self,
      time_warp_w: int = 0,
      freq_mask_n: int = 0,
      freq_mask_f: int = 0,
      time_mask_n: int = 0,
      time_mask_t: int = 0,
      time_mask_p: float = 0.0,
      mask_value: Optional[float] = 0.0,
  ):
      # Sanity checks
      assert mask_value is None or isinstance(
          mask_value, numbers.Number
      ), f"mask_value (type: {type(mask_value)}) must be None or a number"
      if freq_mask_n > 0:
          assert freq_mask_f > 0, (
              f"freq_mask_F ({freq_mask_f}) "
              f"must be larger than 0 when doing freq masking."
          )
      if time_mask_n > 0:
          assert time_mask_t > 0, (
              f"time_mask_T ({time_mask_t}) must be larger than 0 when "
              f"doing time masking."
          )
  
      self.time_warp_w = time_warp_w
      self.freq_mask_n = freq_mask_n
      self.freq_mask_f = freq_mask_f
      self.time_mask_n = time_mask_n
      self.time_mask_t = time_mask_t
      self.time_mask_p = time_mask_p
      self.mask_value = mask_value
  
file_path: fairseq/fairseq/data/audio/feature_transforms/specaugment.py
imports: import math
  import numbers
  from typing import Optional
  import numpy
  from fairseq.data.audio.feature_transforms import AudioFeatureTransform, register_audio_feature_transform
label_desc: Use image node_id 2 to create a new SpecAugmentTransform object from inherited base classes: AudioFeatureTransform with example: obj = SpecAugmentTransform(time_warp_w, freq_mask_n, freq_mask_f, time_mask_n, time_mask_t, time_mask_p, mask_value)