class_docstr: The Tacotron decoder
  
  Arguments
  ---------
  n_mel_channels: int
      the number of channels in the MEL sepctrogram
  n_frames_per_step:
      the number of frames in the spectrogram for each
      time step of the decoder
  encoder_embedding_dim: int
      the dimension of the encoder embedding
  attention_location_n_filters: int
      the number of filters in location-based attention
  attention_location_kernel_size: int
      the kernel size of location-based attention
  attention_rnn_dim: int
      RNN dimension for the attention layer
  decoder_rnn_dim: int
      the encoder RNN dimension
  prenet_dim: int
      the dimension of the prenet (inner and output layers)
  max_decoder_steps: int
      the maximum number of decoder steps for the longest utterance
      expected for the model
  gate_threshold: float
      the fixed threshold to which the outputs of the decoders will be compared
  p_attention_dropout: float
      dropout probability for attention layers
  
  Example
  -------
  >>> import torch
  >>> from speechbrain.lobes.models.Tacotron2 import Decoder
  >>> layer = Decoder()
  >>> memory = torch.randn(2, 173, 512)
  >>> decoder_inputs = torch.randn(2, 80, 173)
  >>> memory_lengths = torch.tensor([173, 91])
  >>> mel_outputs, gate_outputs, alignments = layer(
  ...     memory, decoder_inputs, memory_lengths)
  >>> mel_outputs.shape, gate_outputs.shape, alignments.shape
  (torch.Size([2, 80, 173]), torch.Size([2, 173]), torch.Size([2, 173, 173]))
class_docstr_tok: ["The","Tacotron","decoder","Arguments","--","--","--","--","-","n_mel_channels",":","int","the","number","of","channels","in","the","MEL","sepctrogram","n_frames_per_step",":","the","number","of","frames","in","the","spectrogram","for","each","time","step","of","the","decoder","encoder_embedding_dim",":","int","the","dimension","of","the","encoder","embedding","attention_location_n_filters",":","int","the","number","of","filters","in","location-based","attention","attention_location_kernel_size",":","int","the","kernel","size","of","location-based","attention","attention_rnn_dim",":","int","RNN","dimension","for","the","attention","layer","decoder_rnn_dim",":","int","the","encoder","RNN","dimension","prenet_dim",":","int","the","dimension","of","the","prenet","(","inner","and","output","layers",")","max_decoder_steps",":","int","the","maximum","number","of","decoder","steps","for","the","longest","utterance","expected","for","the","model","gate_threshold",":","float","the","fixed","threshold","to","which","the","outputs","of","the","decoders","will","be","compared","p_attention_dropout",":","float","dropout","probability","for","attention","layers","Example","--","--","--","-",">",">",">","import","torch",">",">",">","from","speechbrain.lobes.models.Tacotron2","import","Decoder",">",">",">","layer","=","Decoder","(",")",">",">",">","memory","=","torch.randn","(","2",",","173",",","512",")",">",">",">","decoder_inputs","=","torch.randn","(","2",",","80",",","173",")",">",">",">","memory_lengths","=","torch.tensor","(","[","173",",","91","]",")",">",">",">","mel_outputs",",","gate_outputs",",","alignments","=","layer","(","...","memory",",","decoder_inputs",",","memory_lengths",")",">",">",">","mel_outputs.shape",",","gate_outputs.shape",",","alignments.shape","(","torch.Size","(","[","2",",","80",",","173","]",")",",","torch.Size","(","[","2",",","173","]",")",",","torch.Size","(","[","2",",","173",",","173","]",")",")"]
code: def __init__(
      self,
      n_mel_channels=80,
      n_frames_per_step=1,
      encoder_embedding_dim=512,
      attention_dim=128,
      attention_location_n_filters=32,
      attention_location_kernel_size=31,
      attention_rnn_dim=1024,
      decoder_rnn_dim=1024,
      prenet_dim=256,
      max_decoder_steps=1000,
      gate_threshold=0.5,
      p_attention_dropout=0.1,
      p_decoder_dropout=0.1,
      early_stopping=True,
  ):
      super().__init__()
      self.n_mel_channels = n_mel_channels
      self.n_frames_per_step = n_frames_per_step
      self.encoder_embedding_dim = encoder_embedding_dim
      self.attention_rnn_dim = attention_rnn_dim
      self.decoder_rnn_dim = decoder_rnn_dim
      self.prenet_dim = prenet_dim
      self.max_decoder_steps = max_decoder_steps
      self.gate_threshold = gate_threshold
      self.p_attention_dropout = p_attention_dropout
      self.p_decoder_dropout = p_decoder_dropout
      self.early_stopping = early_stopping
  
      self.prenet = Prenet(
          n_mel_channels * n_frames_per_step, [prenet_dim, prenet_dim]
      )
  
      self.attention_rnn = nn.LSTMCell(
          prenet_dim + encoder_embedding_dim, attention_rnn_dim
      )
  
      self.attention_layer = Attention(
          attention_rnn_dim,
          encoder_embedding_dim,
          attention_dim,
          attention_location_n_filters,
          attention_location_kernel_size,
      )
  
      self.decoder_rnn = nn.LSTMCell(
          attention_rnn_dim + encoder_embedding_dim, decoder_rnn_dim, 1
      )
  
      self.linear_projection = LinearNorm(
          decoder_rnn_dim + encoder_embedding_dim,
          n_mel_channels * n_frames_per_step,
      )
  
      self.gate_layer = LinearNorm(
          decoder_rnn_dim + encoder_embedding_dim,
          1,
          bias=True,
          w_init_gain="sigmoid",
      )
  
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 1 to create a new Decoder object from inherited base classes: nn with example: obj = Decoder(n_mel_channels, n_frames_per_step, encoder_embedding_dim, attention_dim, attention_location_n_filters, attention_location_kernel_size, attention_rnn_dim, decoder_rnn_dim, prenet_dim, max_decoder_steps, gate_threshold, p_attention_dropout, p_decoder_dropout, early_stopping)