class_docstr: Decoder with Attention model.
  
  Args:
      n_mels (int): number of mel bins
      n_frames_per_step (int): number of frames processed per step, only 1 is supported
      encoder_embedding_dim (int): the number of embedding dimensions in the encoder.
      decoder_rnn_dim (int): number of units in decoder LSTM
      decoder_max_step (int): maximum number of output mel spectrograms
      decoder_dropout (float): dropout probability for decoder LSTM
      decoder_early_stopping (bool): stop decoding when all samples are finished
      attention_rnn_dim (int): number of units in attention LSTM
      attention_hidden_dim (int): dimension of attention hidden representation
      attention_location_n_filter (int): number of filters for attention model
      attention_location_kernel_size (int): kernel size for attention model
      attention_dropout (float): dropout probability for attention LSTM
      prenet_dim (int): number of ReLU units in prenet layers
      gate_threshold (float): probability threshold for stop token
class_docstr_tok: ["Decoder","with","Attention","model",".","Args",":","n_mels","(","int",")",":","number","of","mel","bins","n_frames_per_step","(","int",")",":","number","of","frames","processed","per","step",",","only","1","is","supported","encoder_embedding_dim","(","int",")",":","the","number","of","embedding","dimensions","in","the","encoder",".","decoder_rnn_dim","(","int",")",":","number","of","units","in","decoder","LSTM","decoder_max_step","(","int",")",":","maximum","number","of","output","mel","spectrograms","decoder_dropout","(","float",")",":","dropout","probability","for","decoder","LSTM","decoder_early_stopping","(","bool",")",":","stop","decoding","when","all","samples","are","finished","attention_rnn_dim","(","int",")",":","number","of","units","in","attention","LSTM","attention_hidden_dim","(","int",")",":","dimension","of","attention","hidden","representation","attention_location_n_filter","(","int",")",":","number","of","filters","for","attention","model","attention_location_kernel_size","(","int",")",":","kernel","size","for","attention","model","attention_dropout","(","float",")",":","dropout","probability","for","attention","LSTM","prenet_dim","(","int",")",":","number","of","ReLU","units","in","prenet","layers","gate_threshold","(","float",")",":","probability","threshold","for","stop","token"]
code: def __init__(
      self,
      n_mels: int,
      n_frames_per_step: int,
      encoder_embedding_dim: int,
      decoder_rnn_dim: int,
      decoder_max_step: int,
      decoder_dropout: float,
      decoder_early_stopping: bool,
      attention_rnn_dim: int,
      attention_hidden_dim: int,
      attention_location_n_filter: int,
      attention_location_kernel_size: int,
      attention_dropout: float,
      prenet_dim: int,
      gate_threshold: float,
  ) -> None:
      super().__init__()
      self.n_mels = n_mels
      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.decoder_max_step = decoder_max_step
      self.gate_threshold = gate_threshold
      self.attention_dropout = attention_dropout
      self.decoder_dropout = decoder_dropout
      self.decoder_early_stopping = decoder_early_stopping
  
      self.prenet = _Prenet(
          n_mels * 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_hidden_dim,
          attention_location_n_filter,
          attention_location_kernel_size,
      )
  
      self.decoder_rnn = nn.LSTMCell(
          attention_rnn_dim + encoder_embedding_dim,
          decoder_rnn_dim,
          True,
      )
  
      self.linear_projection = _get_linear_layer(
          decoder_rnn_dim + encoder_embedding_dim,
          n_mels * n_frames_per_step,
      )
  
      self.gate_layer = _get_linear_layer(
          decoder_rnn_dim + encoder_embedding_dim,
          1,
          bias=True,
          w_init_gain="sigmoid",
      )
  
imports: import warnings
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
label_desc: Use image node_id 1 to create a new _Decoder object from inherited base classes: nn with example: obj = _Decoder(n_mels, n_frames_per_step, encoder_embedding_dim, decoder_rnn_dim, decoder_max_step, decoder_dropout, decoder_early_stopping, attention_rnn_dim, attention_hidden_dim, attention_location_n_filter, attention_location_kernel_size, attention_dropout, prenet_dim, gate_threshold)