class_docstr: This class implements 1D Gabor Convolutions 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.
  kernel_size: int
      Kernel size of the convolutional filters.
  stride : int
      Stride factor of the convolutional filters. When the stride factor > 1,
      a decimation in time is performed.
  padding : str
      (same, valid). If "valid", no padding is performed.
      If "same" and stride is 1, output shape is the same as the input shape.
  padding_mode : str
      This flag specifies the type of padding. See torch.nn documentation
      for more information.
  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
  n_fft: int
      number of FFT bins for initialization
  normalize_energy: bool
      whether to normalize energy at initialization. Default is False
  bias : bool
      If True, the additive bias b is adopted.
  sort_filters: bool
      whether to sort filters by center frequencies. Default is False
  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])
  >>> # 401 corresponds to a window of 25 ms at 16000 kHz
  >>> gabor_conv = GaborConv1d(
  ...     40, kernel_size=401, stride=1, in_channels=1
  ... )
  >>> #
  >>> out_tensor = gabor_conv(inp_tensor)
  >>> out_tensor.shape
  torch.Size([10, 8000, 40])
docstr: Returns the output of the Gabor convolution.
  
  Arguments
  ---------
  x : torch.Tensor (batch, time, channel)
      input to convolve.
docstr_tok: ["Returns","the","output","of","the","Gabor","convolution",".","Arguments","--","--","--","--","-","x",":","torch.Tensor","(","batch",",","time",",","channel",")","input","to","convolve","."]
code: def forward(self, x):
      """Returns the output of the Gabor convolution.
  
      Arguments
      ---------
      x : torch.Tensor (batch, time, channel)
          input to convolve.
      """
      if not self.skip_transpose:
          x = x.transpose(1, -1)
  
      unsqueeze = x.ndim == 2
      if unsqueeze:
          x = x.unsqueeze(1)
  
      kernel = self._gabor_constraint(self.kernel)
      if self.sort_filters:
          idxs = torch.argsort(kernel[:, 0])
          kernel = kernel[idxs, :]
  
      filters = self._gabor_filters(kernel)
      if not self.use_legacy_complex:
          temp = torch.view_as_real(filters)
          real_filters = temp[:, :, 0]
          img_filters = temp[:, :, 1]
      else:
          real_filters = filters[:, :, 0]
          img_filters = filters[:, :, 1]
      stacked_filters = torch.cat(
          [real_filters.unsqueeze(1), img_filters.unsqueeze(1)], dim=1
      )
      stacked_filters = torch.reshape(
          stacked_filters, (2 * self.filters, self.kernel_size)
      )
      stacked_filters = stacked_filters.unsqueeze(1)
  
      if self.padding == "same":
          x = self._manage_padding(x, self.kernel_size)
      elif self.padding == "valid":
          pass
      else:
          raise ValueError(
              "Padding must be 'same' or 'valid'. Got " + self.padding
          )
  
      output = F.conv1d(
          x,
          stacked_filters,
          bias=self.bias,
          stride=self.stride,
          padding=0,
      )
      if not self.skip_transpose:
          output = output.transpose(1, -1)
      return output
  
imports: import math
  import torch
  import logging
  import numpy
  import torch.nn
  import torch.nn.functional
  import torchaudio
  from typing import Tuple
  from speechbrain.processing.signal_processing import gabor_impulse_response, gabor_impulse_response_legacy_complex
label_desc: Use image node_id 2 for calling the GaborConv1d obj's underlying member method code with example usage: obj.forward(x) and returns: output