class_docstr: The Tacotron postnet consists of a number of 1-d convolutional layers
  with Xavier initialization and a tanh activation, with batch normalization.
  Depending on configuration, the postnet may either refine the MEL spectrogram
  or upsample it to a linear spectrogram
  
  Arguments
  ---------
  n_mel_channels: int
      the number of MEL spectrogram channels
  postnet_embedding_dim: int
      the postnet embedding dimension
  postnet_kernel_size: int
      the kernel size of the convolutions within the decoders
  postnet_n_convolutions: int
      the number of convolutions in the postnet
  
  Example
  -------
  >>> import torch
  >>> from speechbrain.lobes.models.Tacotron2 import Postnet
  >>> layer = Postnet()
  >>> x = torch.randn(2, 80, 861)
  >>> output = layer(x)
  >>> output.shape
  torch.Size([2, 80, 861])
class_docstr_tok: ["The","Tacotron","postnet","consists","of","a","number","of","1-d","convolutional","layers","with","Xavier","initialization","and","a","tanh","activation",",","with","batch","normalization",".","Depending","on","configuration",",","the","postnet","may","either","refine","the","MEL","spectrogram","or","upsample","it","to","a","linear","spectrogram","Arguments","--","--","--","--","-","n_mel_channels",":","int","the","number","of","MEL","spectrogram","channels","postnet_embedding_dim",":","int","the","postnet","embedding","dimension","postnet_kernel_size",":","int","the","kernel","size","of","the","convolutions","within","the","decoders","postnet_n_convolutions",":","int","the","number","of","convolutions","in","the","postnet","Example","--","--","--","-",">",">",">","import","torch",">",">",">","from","speechbrain.lobes.models.Tacotron2","import","Postnet",">",">",">","layer","=","Postnet","(",")",">",">",">","x","=","torch.randn","(","2",",","80",",","861",")",">",">",">","output","=","layer","(","x",")",">",">",">","output.shape","torch.Size","(","[","2",",","80",",","861","]",")"]
docstr: Computes the forward pass of the postnet
  
  Arguments
  ---------
  x: torch.Tensor
      the postnet input (usually a MEL spectrogram)
  
  Returns
  -------
  output: torch.Tensor
      the postnet output (a refined MEL spectrogram or a
      linear spectrogram depending on how the model is
      configured)
docstr_tok: ["Computes","the","forward","pass","of","the","postnet","Arguments","--","--","--","--","-","x",":","torch.Tensor","the","postnet","input","(","usually","a","MEL","spectrogram",")","Returns","--","--","--","-","output",":","torch.Tensor","the","postnet","output","(","a","refined","MEL","spectrogram","or","a","linear","spectrogram","depending","on","how","the","model","is","configured",")"]
code: def forward(self, x):
      """Computes the forward pass of the postnet
  
      Arguments
      ---------
      x: torch.Tensor
          the postnet input (usually a MEL spectrogram)
  
      Returns
      -------
      output: torch.Tensor
          the postnet output (a refined MEL spectrogram or a
          linear spectrogram depending on how the model is
          configured)
      """
      i = 0
      for conv in self.convolutions:
          if i < self.n_convs - 1:
              x = F.dropout(
                  torch.tanh(conv(x)), 0.5, training=self.training
              )
          else:
              x = F.dropout(conv(x), 0.5, training=self.training)
          i += 1
  
      return x
  
imports: from math import sqrt
  from speechbrain.nnet.loss.guidedattn_loss import GuidedAttentionLoss
  from speechbrain.lobes.models.transformer.Transformer import get_mask_from_lengths
  import torch
  from torch import nn
  from torch.nn import functional
  from collections import namedtuple
label_desc: Use image node_id 2 for calling the Postnet obj's underlying member method code with example usage: obj.forward(x) and returns: x