abs_specaug.py 426 B

123456789101112131415161718
  1. from typing import Optional
  2. from typing import Tuple
  3. import torch
  4. class AbsSpecAug(torch.nn.Module):
  5. """Abstract class for the augmentation of spectrogram
  6. The process-flow:
  7. Frontend -> SpecAug -> Normalization -> Encoder -> Decoder
  8. """
  9. def forward(
  10. self, x: torch.Tensor, x_lengths: torch.Tensor = None
  11. ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]:
  12. raise NotImplementedError