class_docstr: computes filter bank (FBANK) features given spectral magnitudes.
  
  Arguments
  ---------
  n_mels : float
      Number of Mel filters used to average the spectrogram.
  log_mel : bool
      If True, it computes the log of the FBANKs.
  filter_shape : str
      Shape of the filters ('triangular', 'rectangular', 'gaussian').
  f_min : int
      Lowest frequency for the Mel filters.
  f_max : int
      Highest frequency for the Mel filters.
  n_fft : int
      Number of fft points of the STFT. It defines the frequency resolution
      (n_fft should be<= than win_len).
  sample_rate : int
      Sample rate of the input audio signal (e.g, 16000)
  power_spectrogram : float
      Exponent used for spectrogram computation.
  amin : float
      Minimum amplitude (used for numerical stability).
  ref_value : float
      Reference value used for the dB scale.
  top_db : float
      Minimum negative cut-off in decibels.
  freeze : bool
      If False, it the central frequency and the band of each filter are
      added into nn.parameters. If True, the standard frozen features
      are computed.
  param_change_factor: bool
      If freeze=False, this parameter affects the speed at which the filter
      parameters (i.e., central_freqs and bands) can be changed.  When high
      (e.g., param_change_factor=1) the filters change a lot during training.
      When low (e.g. param_change_factor=0.1) the filter parameters are more
      stable during training
  param_rand_factor: float
      This parameter can be used to randomly change the filter parameters
      (i.e, central frequencies and bands) during training.  It is thus a
      sort of regularization. param_rand_factor=0 does not affect, while
      param_rand_factor=0.15 allows random variations within +-15% of the
      standard values of the filter parameters (e.g., if the central freq
      is 100 Hz, we can randomly change it from 85 Hz to 115 Hz).
  
  Example
  -------
  >>> import torch
  >>> compute_fbanks = Filterbank()
  >>> inputs = torch.randn([10, 101, 201])
  >>> features = compute_fbanks(inputs)
  >>> features.shape
  torch.Size([10, 101, 40])
class_docstr_tok: ["computes","filter","bank","(","FBANK",")","features","given","spectral","magnitudes",".","Arguments","--","--","--","--","-","n_mels",":","float","Number","of","Mel","filters","used","to","average","the","spectrogram",".","log_mel",":","bool","If","True",",","it","computes","the","log","of","the","FBANKs",".","filter_shape",":","str","Shape","of","the","filters","(","'triangular","'",",","'rectangular","'",",","'gaussian","'",")",".","f_min",":","int","Lowest","frequency","for","the","Mel","filters",".","f_max",":","int","Highest","frequency","for","the","Mel","filters",".","n_fft",":","int","Number","of","fft","points","of","the","STFT",".","It","defines","the","frequency","resolution","(","n_fft","should","be","<","=","than","win_len",")",".","sample_rate",":","int","Sample","rate","of","the","input","audio","signal","(","e.g",",","16000",")","power_spectrogram",":","float","Exponent","used","for","spectrogram","computation",".","amin",":","float","Minimum","amplitude","(","used","for","numerical","stability",")",".","ref_value",":","float","Reference","value","used","for","the","dB","scale",".","top_db",":","float","Minimum","negative","cut-off","in","decibels",".","freeze",":","bool","If","False",",","it","the","central","frequency","and","the","band","of","each","filter","are","added","into","nn.parameters",".","If","True",",","the","standard","frozen","features","are","computed",".","param_change_factor",":","bool","If","freeze=False",",","this","parameter","affects","the","speed","at","which","the","filter","parameters","(","i.e.",",","central_freqs","and","bands",")","can","be","changed",".","When","high","(","e.g.",",","param_change_factor=1",")","the","filters","change","a","lot","during","training",".","When","low","(","e.g",".","param_change_factor=0.1",")","the","filter","parameters","are","more","stable","during","training","param_rand_factor",":","float","This","parameter","can","be","used","to","randomly","change","the","filter","parameters","(","i.e",",","central","frequencies","and","bands",")","during","training",".","It","is","thus","a","sort","of","regularization",".","param_rand_factor=0","does","not","affect",",","while","param_rand_factor=0.15","allows","random","variations","within","+-15","%","of","the","standard","values","of","the","filter","parameters","(","e.g.",",","if","the","central","freq","is","100","Hz",",","we","can","randomly","change","it","from","85","Hz","to","115","Hz",")",".","Example","--","--","--","-",">",">",">","import","torch",">",">",">","compute_fbanks","=","Filterbank","(",")",">",">",">","inputs","=","torch.randn","(","[","10",",","101",",","201","]",")",">",">",">","features","=","compute_fbanks","(","inputs",")",">",">",">","features.shape","torch.Size","(","[","10",",","101",",","40","]",")"]
code: def __init__(
      self,
      n_mels=40,
      log_mel=True,
      filter_shape="triangular",
      f_min=0,
      f_max=8000,
      n_fft=400,
      sample_rate=16000,
      power_spectrogram=2,
      amin=1e-10,
      ref_value=1.0,
      top_db=80.0,
      param_change_factor=1.0,
      param_rand_factor=0.0,
      freeze=True,
  ):
      super().__init__()
      self.n_mels = n_mels
      self.log_mel = log_mel
      self.filter_shape = filter_shape
      self.f_min = f_min
      self.f_max = f_max
      self.n_fft = n_fft
      self.sample_rate = sample_rate
      self.power_spectrogram = power_spectrogram
      self.amin = amin
      self.ref_value = ref_value
      self.top_db = top_db
      self.freeze = freeze
      self.n_stft = self.n_fft // 2 + 1
      self.db_multiplier = math.log10(max(self.amin, self.ref_value))
      self.device_inp = torch.device("cpu")
      self.param_change_factor = param_change_factor
      self.param_rand_factor = param_rand_factor
  
      if self.power_spectrogram == 2:
          self.multiplier = 10
      else:
          self.multiplier = 20
  
      # Make sure f_min < f_max
      if self.f_min >= self.f_max:
          err_msg = "Require f_min: %f < f_max: %f" % (
              self.f_min,
              self.f_max,
          )
          logger.error(err_msg, exc_info=True)
  
      # Filter definition
      mel = torch.linspace(
          self._to_mel(self.f_min),
          self._to_mel(self.f_max),
          self.n_mels + 2,
      )
      hz = self._to_hz(mel)
  
      # Computation of the filter bands
      band = hz[1:] - hz[:-1]
      self.band = band[:-1]
      self.f_central = hz[1:-1]
  
      # Adding the central frequency and the band to the list of nn param
      if not self.freeze:
          self.f_central = torch.nn.Parameter(
              self.f_central
              / (self.sample_rate * self.param_change_factor)
          )
          self.band = torch.nn.Parameter(
              self.band / (self.sample_rate * self.param_change_factor)
          )
  
      # Frequency axis
      all_freqs = torch.linspace(0, self.sample_rate // 2, self.n_stft)
  
      # Replicating for all the filters
      self.all_freqs_mat = all_freqs.repeat(self.f_central.shape[0], 1)
  
imports: import math
  import torch
  import logging
  from speechbrain.utils.checkpoints import mark_as_saver, mark_as_loader, mark_as_transfer, register_checkpoint_hooks
  from speechbrain.dataio.dataio import length_to_mask
label_desc: Use image node_id 1 to create a new Filterbank object from inherited base classes: torch.nn with example: obj = Filterbank(n_mels, log_mel, filter_shape, f_min, f_max, n_fft, sample_rate, power_spectrogram, amin, ref_value, top_db, param_change_factor, param_rand_factor, freeze)