class_docstr: This class implements the LEAF audio frontend from
  
  Neil Zeghidour, Olivier Teboul, F{'e}lix de Chaumont Quitry & Marco Tagliasacchi, "LEAF: A LEARNABLE FRONTEND
  FOR AUDIO CLASSIFICATION", in Proc. of ICLR 2021 (https://arxiv.org/abs/2101.08596)
  
  Arguments
  ---------
  out_channels : int
      It is the number of output channels.
  window_len: float
      length of filter window in milliseconds
  window_stride : float
      Stride factor of the filters in milliseconds
  sample_rate : int,
      Sampling rate of the input signals. It is only used for sinc_conv.
  min_freq : float
      Lowest possible frequency (in Hz) for a filter
  max_freq : float
      Highest possible frequency (in Hz) for a filter
  use_pcen: bool
      If True (default), a per-channel energy normalization layer is used
  learnable_pcen: bool:
      If True (default), the per-channel energy normalization layer is learnable
  use_legacy_complex: bool
      If False, torch.complex64 data type is used for gabor impulse responses
      If True, computation is performed on two real-valued tensors
  skip_transpose: bool
      If False, uses batch x time x channel convention of speechbrain.
      If True, uses batch x channel x time convention.
  
  Example
  -------
  >>> inp_tensor = torch.rand([10, 8000])
  >>> leaf = Leaf(
  ...     out_channels=40, window_len=25., window_stride=10., in_channels=1
  ... )
  >>> out_tensor = leaf(inp_tensor)
  >>> out_tensor.shape
  torch.Size([10, 50, 40])
class_docstr_tok: ["This","class","implements","the","LEAF","audio","frontend","from","Neil","Zeghidour",",","Olivier","Teboul",",","F","{","'","e","}","lix","de","Chaumont","Quitry","&","Marco","Tagliasacchi",",","``","LEAF",":","A","LEARNABLE","FRONTEND","FOR","AUDIO","CLASSIFICATION","''",",","in","Proc",".","of","ICLR","2021","(","https",":","\/\/arxiv.org\/abs\/2101.08596",")","Arguments","--","--","--","--","-","out_channels",":","int","It","is","the","number","of","output","channels",".","window_len",":","float","length","of","filter","window","in","milliseconds","window_stride",":","float","Stride","factor","of","the","filters","in","milliseconds","sample_rate",":","int",",","Sampling","rate","of","the","input","signals",".","It","is","only","used","for","sinc_conv",".","min_freq",":","float","Lowest","possible","frequency","(","in","Hz",")","for","a","filter","max_freq",":","float","Highest","possible","frequency","(","in","Hz",")","for","a","filter","use_pcen",":","bool","If","True","(","default",")",",","a","per-channel","energy","normalization","layer","is","used","learnable_pcen",":","bool",":","If","True","(","default",")",",","the","per-channel","energy","normalization","layer","is","learnable","use_legacy_complex",":","bool","If","False",",","torch.complex64","data","type","is","used","for","gabor","impulse","responses","If","True",",","computation","is","performed","on","two","real-valued","tensors","skip_transpose",":","bool","If","False",",","uses","batch","x","time","x","channel","convention","of","speechbrain",".","If","True",",","uses","batch","x","channel","x","time","convention",".","Example","--","--","--","-",">",">",">","inp_tensor","=","torch.rand","(","[","10",",","8000","]",")",">",">",">","leaf","=","Leaf","(","...","out_channels=40",",","window_len=25.",",","window_stride=10.",",","in_channels=1","...",")",">",">",">","out_tensor","=","leaf","(","inp_tensor",")",">",">",">","out_tensor.shape","torch.Size","(","[","10",",","50",",","40","]",")"]
code: def __init__(
      self,
      out_channels,
      window_len: float = 25.0,
      window_stride: float = 10.0,
      sample_rate: int = 16000,
      input_shape=None,
      in_channels=None,
      min_freq=60.0,
      max_freq=None,
      use_pcen=True,
      learnable_pcen=True,
      use_legacy_complex=False,
      skip_transpose=False,
      n_fft=512,
  ):
      super(Leaf, self).__init__()
      self.out_channels = out_channels
      window_size = int(sample_rate * window_len // 1000 + 1)
      window_stride = int(sample_rate * window_stride // 1000)
  
      if input_shape is None and in_channels is None:
          raise ValueError(
              "Must provide one of input_shape or in_channels"
          )
  
      if in_channels is None:
          in_channels = self._check_input_shape(input_shape)
  
      self.complex_conv = GaborConv1d(
          out_channels=2 * out_channels,
          in_channels=in_channels,
          kernel_size=window_size,
          stride=1,
          padding="same",
          bias=False,
          n_fft=n_fft,
          sample_rate=sample_rate,
          min_freq=min_freq,
          max_freq=max_freq,
          use_legacy_complex=use_legacy_complex,
          skip_transpose=True,
      )
  
      self.pooling = GaussianLowpassPooling(
          in_channels=self.out_channels,
          kernel_size=window_size,
          stride=window_stride,
          skip_transpose=True,
      )
      if use_pcen:
          self.compression = PCEN(
              self.out_channels,
              alpha=0.96,
              smooth_coef=0.04,
              delta=2.0,
              floor=1e-12,
              trainable=learnable_pcen,
              per_channel_smooth_coef=True,
              skip_transpose=True,
          )
      else:
          self.compression = None
      self.skip_transpose = skip_transpose
  
file_path: speechbrain/speechbrain/lobes/features.py
imports: import torch
  from speechbrain.processing.features import STFT, spectral_magnitude, Filterbank, DCT, Deltas, ContextWindow
  from speechbrain.utils.autocast import fwd_default_precision
  from speechbrain.nnet.CNN import GaborConv1d
  from speechbrain.nnet.normalization import PCEN
  from speechbrain.nnet.pooling import GaussianLowpassPooling
label_desc: Use image node_id 1 to create a new Leaf object from inherited base classes: torch.nn with example: obj = Leaf(out_channels, window_len, window_stride, sample_rate, input_shape, in_channels, min_freq, max_freq, use_pcen, learnable_pcen, use_legacy_complex, skip_transpose, n_fft)