class_docstr: Decoder module of Spectrogram prediction network.
  
  This is a module of decoder of Spectrogram prediction network in Singing Tacotron,
  which described in `https://arxiv.org/pdf/2202.07907v1.pdf`_.
  The decoder generates the sequence of
  features from the sequence of the hidden states.
  
  .. _`Singing-Tacotron: Global Duration Control Attention and Dynamic
  Filter for End-to-end Singing Voice Synthesis`:
     https://arxiv.org/pdf/2202.07907v1.pdf
docstr: Initialize Singing Tacotron decoder module.
  
  Args:
      idim (int): Dimension of the inputs.
      odim (int): Dimension of the outputs.
      att (torch.nn.Module): Instance of attention class.
      dlayers (int, optional): The number of decoder lstm layers.
      dunits (int, optional): The number of decoder lstm units.
      prenet_layers (int, optional): The number of prenet layers.
      prenet_units (int, optional): The number of prenet units.
      postnet_layers (int, optional): The number of postnet layers.
      postnet_filts (int, optional): The number of postnet filter size.
      postnet_chans (int, optional): The number of postnet filter channels.
      output_activation_fn (torch.nn.Module, optional):
          Activation function for outputs.
      cumulate_att_w (bool, optional):
          Whether to cumulate previous attention weight.
      use_batch_norm (bool, optional): Whether to use batch normalization.
      use_concate (bool, optional): Whether to concatenate encoder embedding
          with decoder lstm outputs.
      dropout_rate (float, optional): Dropout rate.
      zoneout_rate (float, optional): Zoneout rate.
      reduction_factor (int, optional): Reduction factor.
code: def __init__(
      self,
      idim,
      odim,
      att,
      dlayers=2,
      dunits=1024,
      prenet_layers=2,
      prenet_units=256,
      postnet_layers=5,
      postnet_chans=512,
      postnet_filts=5,
      output_activation_fn=None,
      cumulate_att_w=True,
      use_batch_norm=True,
      use_concate=True,
      dropout_rate=0.5,
      zoneout_rate=0.1,
      reduction_factor=1,
  ):
      """Initialize Singing Tacotron decoder module.
  
      Args:
          idim (int): Dimension of the inputs.
          odim (int): Dimension of the outputs.
          att (torch.nn.Module): Instance of attention class.
          dlayers (int, optional): The number of decoder lstm layers.
          dunits (int, optional): The number of decoder lstm units.
          prenet_layers (int, optional): The number of prenet layers.
          prenet_units (int, optional): The number of prenet units.
          postnet_layers (int, optional): The number of postnet layers.
          postnet_filts (int, optional): The number of postnet filter size.
          postnet_chans (int, optional): The number of postnet filter channels.
          output_activation_fn (torch.nn.Module, optional):
              Activation function for outputs.
          cumulate_att_w (bool, optional):
              Whether to cumulate previous attention weight.
          use_batch_norm (bool, optional): Whether to use batch normalization.
          use_concate (bool, optional): Whether to concatenate encoder embedding
              with decoder lstm outputs.
          dropout_rate (float, optional): Dropout rate.
          zoneout_rate (float, optional): Zoneout rate.
          reduction_factor (int, optional): Reduction factor.
  
      """
      super(Decoder, self).__init__()
  
      # store the hyperparameters
      self.idim = idim
      self.odim = odim
      self.att = att
      self.output_activation_fn = output_activation_fn
      self.cumulate_att_w = cumulate_att_w
      self.use_concate = use_concate
      self.reduction_factor = reduction_factor
  
      # check attention type
      if isinstance(self.att, AttForwardTA):
          self.use_att_extra_inputs = True
      else:
          self.use_att_extra_inputs = False
  
      # define lstm network
      prenet_units = prenet_units if prenet_layers != 0 else odim
      self.lstm = torch.nn.ModuleList()
      for layer in six.moves.range(dlayers):
          iunits = idim + prenet_units if layer == 0 else dunits
          lstm = torch.nn.LSTMCell(iunits, dunits)
          if zoneout_rate > 0.0:
              lstm = ZoneOutCell(lstm, zoneout_rate)
          self.lstm += [lstm]
  
      # define prenet
      if prenet_layers > 0:
          self.prenet = Prenet(
              idim=odim,
              n_layers=prenet_layers,
              n_units=prenet_units,
              dropout_rate=dropout_rate,
          )
      else:
          self.prenet = None
  
      # define postnet
      if postnet_layers > 0:
          self.postnet = Postnet(
              idim=idim,
              odim=odim,
              n_layers=postnet_layers,
              n_chans=postnet_chans,
              n_filts=postnet_filts,
              use_batch_norm=use_batch_norm,
              dropout_rate=dropout_rate,
          )
      else:
          self.postnet = None
  
      # define projection layers
      iunits = idim + dunits if use_concate else dunits
      self.feat_out = torch.nn.Linear(
          iunits, odim * reduction_factor, bias=False
      )
      self.prob_out = torch.nn.Linear(iunits, reduction_factor)
  
      # initialize
      self.apply(decoder_init)
  
file_path: espnet/espnet2/svs/singing_tacotron/decoder.py
imports: import six
  import torch
  import torch.nn.functional
  from espnet.nets.pytorch_backend.rnn.attentions import AttForwardTA
  from espnet.nets.pytorch_backend.tacotron2.decoder import Postnet, Prenet, ZoneOutCell
label_desc: Use image node_id 1 to create a new Decoder object from inherited base classes: torch.nn with example: obj = Decoder(idim, odim, att, dlayers, dunits, prenet_layers, prenet_units, postnet_layers, postnet_chans, postnet_filts, output_activation_fn, cumulate_att_w, use_batch_norm, use_concate, dropout_rate, zoneout_rate, reduction_factor)