docstr: Tacotron 2 Postnet. A convolutional network with postnet_n_convolutions number of layers. Each layer has a
  kernel of postnet_kernel_size. Each layer apart from the last outputs postnet_embedding_dim channels, the last
  outputs n_mel_channels channels. After each layer is a dropout layer with p_dropout% drop. The last linear has
  no activation, all intermediate layers have tanh activation.
  
  Args:
      n_mel_channels (int): Number of mel channels to output from Posnet.
      postnet_embedding_dim (int): Number of channels to output from the intermediate layers.
      postnet_kernel_size (int): The kernel size for the convolution layers.
      postnet_n_convolutions (int): The number of convolutions layers.
      p_dropout (float): Dropout probability. Defaults to 0.5.
docstr_tok: ["Tacotron","2","Postnet",".","A","convolutional","network","with","postnet_n_convolutions","number","of","layers",".","Each","layer","has","a","kernel","of","postnet_kernel_size",".","Each","layer","apart","from","the","last","outputs","postnet_embedding_dim","channels",",","the","last","outputs","n_mel_channels","channels",".","After","each","layer","is","a","dropout","layer","with","p_dropout","%","drop",".","The","last","linear","has","no","activation",",","all","intermediate","layers","have","tanh","activation",".","Args",":","n_mel_channels","(","int",")",":","Number","of","mel","channels","to","output","from","Posnet",".","postnet_embedding_dim","(","int",")",":","Number","of","channels","to","output","from","the","intermediate","layers",".","postnet_kernel_size","(","int",")",":","The","kernel","size","for","the","convolution","layers",".","postnet_n_convolutions","(","int",")",":","The","number","of","convolutions","layers",".","p_dropout","(","float",")",":","Dropout","probability",".","Defaults","to","0.5","."]
code: def __init__(
      self,
      n_mel_channels: int,
      postnet_embedding_dim: int,
      postnet_kernel_size: int,
      postnet_n_convolutions: int,
      p_dropout: float = 0.5,
  ):
      """
      Tacotron 2 Postnet. A convolutional network with postnet_n_convolutions number of layers. Each layer has a
      kernel of postnet_kernel_size. Each layer apart from the last outputs postnet_embedding_dim channels, the last
      outputs n_mel_channels channels. After each layer is a dropout layer with p_dropout% drop. The last linear has
      no activation, all intermediate layers have tanh activation.
  
      Args:
          n_mel_channels (int): Number of mel channels to output from Posnet.
          postnet_embedding_dim (int): Number of channels to output from the intermediate layers.
          postnet_kernel_size (int): The kernel size for the convolution layers.
          postnet_n_convolutions (int): The number of convolutions layers.
          p_dropout (float): Dropout probability. Defaults to 0.5.
      """
      super().__init__()
      self.convolutions = torch.nn.ModuleList()
  
      self.convolutions.append(
          torch.nn.Sequential(
              ConvNorm(
                  n_mel_channels,
                  postnet_embedding_dim,
                  kernel_size=postnet_kernel_size,
                  stride=1,
                  padding=int((postnet_kernel_size - 1) / 2),
                  dilation=1,
                  w_init_gain="tanh",
              ),
              torch.nn.BatchNorm1d(postnet_embedding_dim),
          )
      )
  
      for _ in range(1, postnet_n_convolutions - 1):
          self.convolutions.append(
              torch.nn.Sequential(
                  ConvNorm(
                      postnet_embedding_dim,
                      postnet_embedding_dim,
                      kernel_size=postnet_kernel_size,
                      stride=1,
                      padding=int((postnet_kernel_size - 1) / 2),
                      dilation=1,
                      w_init_gain="tanh",
                  ),
                  torch.nn.BatchNorm1d(postnet_embedding_dim),
              )
          )
  
      self.convolutions.append(
          torch.nn.Sequential(
              ConvNorm(
                  postnet_embedding_dim,
                  n_mel_channels,
                  kernel_size=postnet_kernel_size,
                  stride=1,
                  padding=int((postnet_kernel_size - 1) / 2),
                  dilation=1,
                  w_init_gain="linear",
              ),
              torch.nn.BatchNorm1d(n_mel_channels),
          )
      )
      self.p_dropout = p_dropout
  
imports: import torch
  from torch.autograd import Variable
  from torch.nn import functional
  from nemo.collections.tts.modules.submodules import Attention, ConvNorm, LinearNorm, Prenet
  from nemo.collections.tts.parts.utils.helpers import get_mask_from_lengths
  from nemo.core.classes import NeuralModule, typecheck
  from nemo.core.neural_types.elements import EmbeddedTextType, LengthsType, LogitsType, MelSpectrogramType, SequenceToSequenceAlignmentType
  from nemo.core.neural_types.neural_type import NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new Postnet object from inherited base classes: NeuralModule with example: obj = Postnet(n_mel_channels, postnet_embedding_dim, postnet_kernel_size, postnet_n_convolutions, p_dropout)