class_docstr: This class drops a random frequency from the signal.
  
  The purpose of this class is to teach models to learn to rely on all parts
  of the signal, not just a few frequency bands.
  
  Arguments
  ---------
  drop_freq_low : float
      The low end of frequencies that can be dropped,
      as a fraction of the sampling rate / 2.
  drop_freq_high : float
      The high end of frequencies that can be
      dropped, as a fraction of the sampling rate / 2.
  drop_freq_count_low : int
      The low end of number of frequencies that could be dropped.
  drop_freq_count_high : int
      The high end of number of frequencies that could be dropped.
  drop_freq_width : float
      The width of the frequency band to drop, as
      a fraction of the sampling_rate / 2.
  
  Example
  -------
  >>> from speechbrain.dataio.dataio import read_audio
  >>> dropper = DropFreq()
  >>> signal = read_audio('tests/samples/single-mic/example1.wav')
  >>> dropped_signal = dropper(signal.unsqueeze(0))
class_docstr_tok: ["This","class","drops","a","random","frequency","from","the","signal",".","The","purpose","of","this","class","is","to","teach","models","to","learn","to","rely","on","all","parts","of","the","signal",",","not","just","a","few","frequency","bands",".","Arguments","--","--","--","--","-","drop_freq_low",":","float","The","low","end","of","frequencies","that","can","be","dropped",",","as","a","fraction","of","the","sampling","rate","\/","2.","drop_freq_high",":","float","The","high","end","of","frequencies","that","can","be","dropped",",","as","a","fraction","of","the","sampling","rate","\/","2.","drop_freq_count_low",":","int","The","low","end","of","number","of","frequencies","that","could","be","dropped",".","drop_freq_count_high",":","int","The","high","end","of","number","of","frequencies","that","could","be","dropped",".","drop_freq_width",":","float","The","width","of","the","frequency","band","to","drop",",","as","a","fraction","of","the","sampling_rate","\/","2",".","Example","--","--","--","-",">",">",">","from","speechbrain.dataio.dataio","import","read_audio",">",">",">","dropper","=","DropFreq","(",")",">",">",">","signal","=","read_audio","(","'tests\/samples\/single-mic\/example1.wav","'",")",">",">",">","dropped_signal","=","dropper","(","signal.unsqueeze","(","0",")",")"]
docstr: Arguments
  ---------
  waveforms : tensor
      Shape should be `[batch, time]` or `[batch, time, channels]`.
  
  Returns
  -------
  Tensor of shape `[batch, time]` or `[batch, time, channels]`.
docstr_tok: ["Arguments","--","--","--","--","-","waveforms",":","tensor","Shape","should","be","`","[","batch",",","time","]","`","or","`","[","batch",",","time",",","channels","]","`",".","Returns","--","--","--","-","Tensor","of","shape","`","[","batch",",","time","]","`","or","`","[","batch",",","time",",","channels","]","`","."]
code: def forward(self, waveforms):
      """
      Arguments
      ---------
      waveforms : tensor
          Shape should be `[batch, time]` or `[batch, time, channels]`.
  
      Returns
      -------
      Tensor of shape `[batch, time]` or `[batch, time, channels]`.
      """
  
      # Don't drop (return early) 1-`drop_prob` portion of the batches
      dropped_waveform = waveforms.clone()
  
      # Add channels dimension
      if len(waveforms.shape) == 2:
          dropped_waveform = dropped_waveform.unsqueeze(-1)
  
      # Pick number of frequencies to drop
      drop_count = torch.randint(
          low=self.drop_freq_count_low,
          high=self.drop_freq_count_high + 1,
          size=(1,),
      )
  
      # Pick a frequency to drop
      drop_range = self.drop_freq_high - self.drop_freq_low
      drop_frequency = (
          torch.rand(drop_count) * drop_range + self.drop_freq_low
      )
  
      # Filter parameters
      filter_length = 101
      pad = filter_length // 2
  
      # Start with delta function
      drop_filter = torch.zeros(
          1, filter_length, 1, device=waveforms.device
      )
      drop_filter[0, pad, 0] = 1
  
      # Subtract each frequency
      for frequency in drop_frequency:
          notch_kernel = notch_filter(
              frequency, filter_length, self.drop_freq_width
          ).to(waveforms.device)
          drop_filter = convolve1d(drop_filter, notch_kernel, pad)
  
      # Manage multiple channels
      if len(waveforms.shape) == 3:
          dropped_waveform = dropped_waveform.reshape(
              dropped_waveform.shape[0] * dropped_waveform.shape[2],
              dropped_waveform.shape[1],
              1,
          )
  
      # Apply filter
      dropped_waveform = convolve1d(dropped_waveform, drop_filter, pad)
  
      if len(waveforms.shape) == 3:
          dropped_waveform = dropped_waveform.reshape(
              waveforms.shape[0], waveforms.shape[1], waveforms.shape[2]
          )
  
      # Remove channels dimension if added
      return dropped_waveform.squeeze(-1)
  
imports: import math
  import random
  import torch
  import torch.nn.functional
  from speechbrain.dataio.legacy import ExtendedCSVDataset
  from speechbrain.dataio.dataloader import make_dataloader
  from speechbrain.processing.signal_processing import compute_amplitude, dB_to_amplitude, convolve1d, notch_filter, reverberate
label_desc: Use image node_id 2 for calling the DropFreq obj's underlying member method code with example usage: obj.forward(waveforms) and returns: dropped_waveform