class_docstr: CBHG module to convert log Mel-filterbanks to linear spectrogram.
  
  This is a module of CBHG introduced
  in `Tacotron: Towards End-to-End Speech Synthesis`_.
  The CBHG converts the sequence of log Mel-filterbanks into linear spectrogram.
  
  .. _`Tacotron: Towards End-to-End Speech Synthesis`:
       https://arxiv.org/abs/1703.10135
class_docstr_tok: ["CBHG","module","to","convert","log","Mel-filterbanks","to","linear","spectrogram",".","This","is","a","module","of","CBHG","introduced","in","`","Tacotron",":","Towards","End-to-End","Speech","Synthesis","`","_",".","The","CBHG","converts","the","sequence","of","log","Mel-filterbanks","into","linear","spectrogram",".","..","_","`","Tacotron",":","Towards","End-to-End","Speech","Synthesis","`",":","https",":","\/\/arxiv.org\/abs\/1703.10135"]
docstr: Initialize CBHG module.
  
  Args:
      idim (int): Dimension of the inputs.
      odim (int): Dimension of the outputs.
      conv_bank_layers (int, optional): The number of convolution bank layers.
      conv_bank_chans (int, optional): The number of channels in convolution bank.
      conv_proj_filts (int, optional):
          Kernel size of convolutional projection layer.
      conv_proj_chans (int, optional):
          The number of channels in convolutional projection layer.
      highway_layers (int, optional): The number of highway network layers.
      highway_units (int, optional): The number of highway network units.
      gru_units (int, optional): The number of GRU units (for both directions).
docstr_tok: ["Initialize","CBHG","module",".","Args",":","idim","(","int",")",":","Dimension","of","the","inputs",".","odim","(","int",")",":","Dimension","of","the","outputs",".","conv_bank_layers","(","int",",","optional",")",":","The","number","of","convolution","bank","layers",".","conv_bank_chans","(","int",",","optional",")",":","The","number","of","channels","in","convolution","bank",".","conv_proj_filts","(","int",",","optional",")",":","Kernel","size","of","convolutional","projection","layer",".","conv_proj_chans","(","int",",","optional",")",":","The","number","of","channels","in","convolutional","projection","layer",".","highway_layers","(","int",",","optional",")",":","The","number","of","highway","network","layers",".","highway_units","(","int",",","optional",")",":","The","number","of","highway","network","units",".","gru_units","(","int",",","optional",")",":","The","number","of","GRU","units","(","for","both","directions",")","."]
code: def __init__(
      self,
      idim,
      odim,
      conv_bank_layers=8,
      conv_bank_chans=128,
      conv_proj_filts=3,
      conv_proj_chans=256,
      highway_layers=4,
      highway_units=128,
      gru_units=256,
  ):
      """Initialize CBHG module.
  
      Args:
          idim (int): Dimension of the inputs.
          odim (int): Dimension of the outputs.
          conv_bank_layers (int, optional): The number of convolution bank layers.
          conv_bank_chans (int, optional): The number of channels in convolution bank.
          conv_proj_filts (int, optional):
              Kernel size of convolutional projection layer.
          conv_proj_chans (int, optional):
              The number of channels in convolutional projection layer.
          highway_layers (int, optional): The number of highway network layers.
          highway_units (int, optional): The number of highway network units.
          gru_units (int, optional): The number of GRU units (for both directions).
  
      """
      super(CBHG, self).__init__()
      self.idim = idim
      self.odim = odim
      self.conv_bank_layers = conv_bank_layers
      self.conv_bank_chans = conv_bank_chans
      self.conv_proj_filts = conv_proj_filts
      self.conv_proj_chans = conv_proj_chans
      self.highway_layers = highway_layers
      self.highway_units = highway_units
      self.gru_units = gru_units
  
      # define 1d convolution bank
      self.conv_bank = torch.nn.ModuleList()
      for k in range(1, self.conv_bank_layers + 1):
          if k % 2 != 0:
              padding = (k - 1) // 2
          else:
              padding = ((k - 1) // 2, (k - 1) // 2 + 1)
          self.conv_bank += [
              torch.nn.Sequential(
                  torch.nn.ConstantPad1d(padding, 0.0),
                  torch.nn.Conv1d(
                      idim,
                      self.conv_bank_chans,
                      k,
                      stride=1,
                      padding=0,
                      bias=True,
                  ),
                  torch.nn.BatchNorm1d(self.conv_bank_chans),
                  torch.nn.ReLU(),
              )
          ]
  
      # define max pooling (need padding for one-side to keep same length)
      self.max_pool = torch.nn.Sequential(
          torch.nn.ConstantPad1d((0, 1), 0.0),
          torch.nn.MaxPool1d(2, stride=1),
      )
  
      # define 1d convolution projection
      self.projections = torch.nn.Sequential(
          torch.nn.Conv1d(
              self.conv_bank_chans * self.conv_bank_layers,
              self.conv_proj_chans,
              self.conv_proj_filts,
              stride=1,
              padding=(self.conv_proj_filts - 1) // 2,
              bias=True,
          ),
          torch.nn.BatchNorm1d(self.conv_proj_chans),
          torch.nn.ReLU(),
          torch.nn.Conv1d(
              self.conv_proj_chans,
              self.idim,
              self.conv_proj_filts,
              stride=1,
              padding=(self.conv_proj_filts - 1) // 2,
              bias=True,
          ),
          torch.nn.BatchNorm1d(self.idim),
      )
  
      # define highway network
      self.highways = torch.nn.ModuleList()
      self.highways += [torch.nn.Linear(idim, self.highway_units)]
      for _ in range(self.highway_layers):
          self.highways += [HighwayNet(self.highway_units)]
  
      # define bidirectional GRU
      self.gru = torch.nn.GRU(
          self.highway_units,
          gru_units // 2,
          num_layers=1,
          batch_first=True,
          bidirectional=True,
      )
  
      # define final projection
      self.output = torch.nn.Linear(gru_units, odim, bias=True)
  
file_path: espnet/espnet/nets/pytorch_backend/tacotron2/cbhg.py
imports: import torch
  import torch.nn.functional
  from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
label_desc: Use image node_id 1 to create a new CBHG object from inherited base classes: torch.nn with example: obj = CBHG(idim, odim, conv_bank_layers, conv_bank_chans, conv_proj_filts, conv_proj_chans, highway_layers, highway_units, gru_units)