class_docstr: Implementation of SpecAug.
  
  Reference:
      Daniel S. Park et al.
      "SpecAugment: A Simple Data
       Augmentation Method for Automatic Speech Recognition"
  
  .. warning::
      When using cuda mode, time_warp doesn't have reproducibility
      due to `torch.nn.functional.interpolate`.
code: def __init__(
      self,
      apply_time_warp: bool = True,
      time_warp_window: int = 5,
      time_warp_mode: str = "bicubic",
      apply_freq_mask: bool = True,
      freq_mask_width_range: Union[int, Sequence[int]] = (0, 20),
      num_freq_mask: int = 2,
      apply_time_mask: bool = True,
      time_mask_width_range: Optional[Union[int, Sequence[int]]] = None,
      time_mask_width_ratio_range: Optional[
          Union[float, Sequence[float]]
      ] = None,
      num_time_mask: int = 2,
  ):
      if (
          not apply_time_warp
          and not apply_time_mask
          and not apply_freq_mask
      ):
          raise ValueError(
              "Either one of time_warp, time_mask, or freq_mask should be applied"
          )
      if (
          apply_time_mask
          and (time_mask_width_range is not None)
          and (time_mask_width_ratio_range is not None)
      ):
          raise ValueError(
              'Either one of "time_mask_width_range" or '
              '"time_mask_width_ratio_range" can be used'
          )
      super().__init__()
      self.apply_time_warp = apply_time_warp
      self.apply_freq_mask = apply_freq_mask
      self.apply_time_mask = apply_time_mask
  
      if apply_time_warp:
          self.time_warp = TimeWarp(
              window=time_warp_window, mode=time_warp_mode
          )
      else:
          self.time_warp = None
  
      if apply_freq_mask:
          self.freq_mask = MaskAlongAxis(
              dim="freq",
              mask_width_range=freq_mask_width_range,
              num_mask=num_freq_mask,
          )
      else:
          self.freq_mask = None
  
      if apply_time_mask:
          if time_mask_width_range is not None:
              self.time_mask = MaskAlongAxis(
                  dim="time",
                  mask_width_range=time_mask_width_range,
                  num_mask=num_time_mask,
              )
          elif time_mask_width_ratio_range is not None:
              self.time_mask = MaskAlongAxisVariableMaxWidth(
                  dim="time",
                  mask_width_ratio_range=time_mask_width_ratio_range,
                  num_mask=num_time_mask,
              )
          else:
              raise ValueError(
                  'Either one of "time_mask_width_range" or '
                  '"time_mask_width_ratio_range" should be used.'
              )
      else:
          self.time_mask = None
  
imports: from typing import Optional, Sequence, Union
  from espnet2.asr.specaug.abs_specaug import AbsSpecAug
  from espnet2.layers.mask_along_axis import MaskAlongAxis, MaskAlongAxisVariableMaxWidth
  from espnet2.layers.time_warp import TimeWarp
label_desc: Use image node_id 1 to create a new SpecAug object from inherited base classes: AbsSpecAug with example: obj = SpecAug(apply_time_warp, time_warp_window, time_warp_mode, apply_freq_mask, freq_mask_width_range, num_freq_mask, apply_time_mask, time_mask_width_range, time_mask_width_ratio_range, num_time_mask)