class_docstr: PQMF module.
  
  This module is based on `Near-perfect-reconstruction pseudo-QMF banks`_.
  
  .. _`Near-perfect-reconstruction pseudo-QMF banks`:
      https://ieeexplore.ieee.org/document/258122
docstr: Initilize PQMF module.
  
  The cutoff_ratio and beta parameters are optimized for #subbands = 4.
  See dicussion in https://github.com/kan-bayashi/ParallelWaveGAN/issues/195.
  
  Args:
      subbands (int): The number of subbands.
      taps (int): The number of filter taps.
      cutoff_ratio (float): Cut-off frequency ratio.
      beta (float): Beta coefficient for kaiser window.
docstr_tok: ["Initilize","PQMF","module",".","The","cutoff_ratio","and","beta","parameters","are","optimized","for","#","subbands","=","4",".","See","dicussion","in","https",":","\/\/github.com\/kan-bayashi\/ParallelWaveGAN\/issues\/195",".","Args",":","subbands","(","int",")",":","The","number","of","subbands",".","taps","(","int",")",":","The","number","of","filter","taps",".","cutoff_ratio","(","float",")",":","Cut-off","frequency","ratio",".","beta","(","float",")",":","Beta","coefficient","for","kaiser","window","."]
code: def __init__(
      self,
      subbands: int = 4,
      taps: int = 62,
      cutoff_ratio: float = 0.142,
      beta: float = 9.0,
  ):
      """Initilize PQMF module.
  
      The cutoff_ratio and beta parameters are optimized for #subbands = 4.
      See dicussion in https://github.com/kan-bayashi/ParallelWaveGAN/issues/195.
  
      Args:
          subbands (int): The number of subbands.
          taps (int): The number of filter taps.
          cutoff_ratio (float): Cut-off frequency ratio.
          beta (float): Beta coefficient for kaiser window.
  
      """
      super().__init__()
  
      # build analysis & synthesis filter coefficients
      h_proto = design_prototype_filter(taps, cutoff_ratio, beta)
      h_analysis = np.zeros((subbands, len(h_proto)))
      h_synthesis = np.zeros((subbands, len(h_proto)))
      for k in range(subbands):
          h_analysis[k] = (
              2
              * h_proto
              * np.cos(
                  (2 * k + 1)
                  * (np.pi / (2 * subbands))
                  * (np.arange(taps + 1) - (taps / 2))
                  + (-1) ** k * np.pi / 4
              )
          )
          h_synthesis[k] = (
              2
              * h_proto
              * np.cos(
                  (2 * k + 1)
                  * (np.pi / (2 * subbands))
                  * (np.arange(taps + 1) - (taps / 2))
                  - (-1) ** k * np.pi / 4
              )
          )
  
      # convert to tensor
      analysis_filter = (
          torch.from_numpy(h_analysis).float().unsqueeze(1)
      )
      synthesis_filter = (
          torch.from_numpy(h_synthesis).float().unsqueeze(0)
      )
  
      # register coefficients as beffer
      self.register_buffer("analysis_filter", analysis_filter)
      self.register_buffer("synthesis_filter", synthesis_filter)
  
      # filter for downsampling & upsampling
      updown_filter = torch.zeros(
          (subbands, subbands, subbands)
      ).float()
      for k in range(subbands):
          updown_filter[k, k, 0] = 1.0
      self.register_buffer("updown_filter", updown_filter)
      self.subbands = subbands
  
      # keep padding info
      self.pad_fn = torch.nn.ConstantPad1d(taps // 2, 0.0)
  
file_path: espnet/espnet2/gan_tts/melgan/pqmf.py
imports: import numpy
  import torch
  import torch.nn.functional
  from scipy.signal import kaiser
label_desc: Use image node_id 1 to create a new PQMF object from inherited base classes: torch.nn with example: obj = PQMF(subbands, taps, cutoff_ratio, beta)