class_docstr: Sinc Convolution.
  
  This module performs a convolution using Sinc filters in time domain as kernel.
  Sinc filters function as band passes in spectral domain.
  The filtering is done as a convolution in time domain, and no transformation
  to spectral domain is necessary.
  
  This implementation of the Sinc convolution is heavily inspired
  by Ravanelli et al. https://github.com/mravanelli/SincNet,
  and adapted for the ESpnet toolkit.
  Combine Sinc convolutions with a log compression activation function, as in:
  https://arxiv.org/abs/2010.07597
  
  Notes:
  Currently, the same filters are applied to all input channels.
  The windowing function is applied on the kernel to obtained a smoother filter,
  and not on the input values, which is different to traditional ASR.
class_docstr_tok: ["Sinc","Convolution",".","This","module","performs","a","convolution","using","Sinc","filters","in","time","domain","as","kernel",".","Sinc","filters","function","as","band","passes","in","spectral","domain",".","The","filtering","is","done","as","a","convolution","in","time","domain",",","and","no","transformation","to","spectral","domain","is","necessary",".","This","implementation","of","the","Sinc","convolution","is","heavily","inspired","by","Ravanelli","et","al",".","https",":","\/\/github.com\/mravanelli\/SincNet",",","and","adapted","for","the","ESpnet","toolkit",".","Combine","Sinc","convolutions","with","a","log","compression","activation","function",",","as","in",":","https",":","\/\/arxiv.org\/abs\/2010.07597","Notes",":","Currently",",","the","same","filters","are","applied","to","all","input","channels",".","The","windowing","function","is","applied","on","the","kernel","to","obtained","a","smoother","filter",",","and","not","on","the","input","values",",","which","is","different","to","traditional","ASR","."]
docstr: Initialize Sinc convolutions.
  
  Args:
      in_channels: Number of input channels.
      out_channels: Number of output channels.
      kernel_size: Sinc filter kernel size (needs to be an odd number).
      stride: See torch.nn.functional.conv1d.
      padding: See torch.nn.functional.conv1d.
      dilation: See torch.nn.functional.conv1d.
      window_func: Window function on the filter, one of ["hamming", "none"].
      fs (str, int, float): Sample rate of the input data
docstr_tok: ["Initialize","Sinc","convolutions",".","Args",":","in_channels",":","Number","of","input","channels",".","out_channels",":","Number","of","output","channels",".","kernel_size",":","Sinc","filter","kernel","size","(","needs","to","be","an","odd","number",")",".","stride",":","See","torch.nn.functional.conv1d",".","padding",":","See","torch.nn.functional.conv1d",".","dilation",":","See","torch.nn.functional.conv1d",".","window_func",":","Window","function","on","the","filter",",","one","of","[","``","hamming","''",",","``","none","''","]",".","fs","(","str",",","int",",","float",")",":","Sample","rate","of","the","input","data"]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      kernel_size: int,
      stride: int = 1,
      padding: int = 0,
      dilation: int = 1,
      window_func: str = "hamming",
      scale_type: str = "mel",
      fs: Union[int, float] = 16000,
  ):
      """Initialize Sinc convolutions.
  
      Args:
          in_channels: Number of input channels.
          out_channels: Number of output channels.
          kernel_size: Sinc filter kernel size (needs to be an odd number).
          stride: See torch.nn.functional.conv1d.
          padding: See torch.nn.functional.conv1d.
          dilation: See torch.nn.functional.conv1d.
          window_func: Window function on the filter, one of ["hamming", "none"].
          fs (str, int, float): Sample rate of the input data
      """
      assert check_argument_types()
      super().__init__()
      window_funcs = {
          "none": self.none_window,
          "hamming": self.hamming_window,
      }
      if window_func not in window_funcs:
          raise NotImplementedError(
              f"Window function has to be one of {list(window_funcs.keys())}",
          )
      self.window_func = window_funcs[window_func]
      scale_choices = {
          "mel": MelScale,
          "bark": BarkScale,
      }
      if scale_type not in scale_choices:
          raise NotImplementedError(
              f"Scale has to be one of {list(scale_choices.keys())}",
          )
      self.scale = scale_choices[scale_type]
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.kernel_size = kernel_size
      self.padding = padding
      self.dilation = dilation
      self.stride = stride
      self.fs = float(fs)
      if self.kernel_size % 2 == 0:
          raise ValueError("SincConv: Kernel size must be odd.")
      self.f = None
      N = self.kernel_size // 2
      self._x = 2 * math.pi * torch.linspace(1, N, N)
      self._window = self.window_func(torch.linspace(1, N, N))
      # init may get overwritten by E2E network,
      # but is still required to calculate output dim
      self.init_filters()
  
imports: import math
  from typing import Union
  import torch
  from typeguard import check_argument_types
label_desc: Use image node_id 1 to create a new SincConv object from inherited base classes: torch.nn with example: obj = SincConv(in_channels, out_channels, kernel_size, stride, padding, dilation, window_func, scale_type, fs)