class_docstr: Tacotron2 decoder. We don't use Zoneout but Dropout between RNN layers.
  
  Args:
      in_channels (int): number of input channels.
      frame_channels (int): number of feature frame channels.
      r (int): number of outputs per time step (reduction rate).
      memory_size (int): size of the past window. if <= 0 memory_size = r
      attn_type (string): type of attention used in decoder.
      attn_win (bool): if true, define an attention window centered to maximum
          attention response. It provides more robust attention alignment especially
          at interence time.
      attn_norm (string): attention normalization function. 'sigmoid' or 'softmax'.
      prenet_type (string): 'original' or 'bn'.
      prenet_dropout (float): prenet dropout rate.
      forward_attn (bool): if true, use forward attention method. https://arxiv.org/abs/1807.06736
      trans_agent (bool): if true, use transition agent. https://arxiv.org/abs/1807.06736
      forward_attn_mask (bool): if true, mask attention values smaller than a threshold.
      location_attn (bool): if true, use location sensitive attention.
      attn_K (int): number of attention heads for GravesAttention.
      separate_stopnet (bool): if true, detach stopnet input to prevent gradient flow.
docstr: Train Decoder with teacher forcing.
  Args:
      inputs: Encoder outputs.
      memories: Feature frames for teacher-forcing.
      mask: Attention mask for sequence padding.
  
  Shapes:
      - inputs: (B, T, D_out_enc)
      - memory: (B, T_mel, D_mel)
      - outputs: (B, T_mel, D_mel)
      - alignments: (B, T_in, T_out)
      - stop_tokens: (B, T_out)
docstr_tok: ["Train","Decoder","with","teacher","forcing",".","Args",":","inputs",":","Encoder","outputs",".","memories",":","Feature","frames","for","teacher-forcing",".","mask",":","Attention","mask","for","sequence","padding",".","Shapes",":","-","inputs",":","(","B",",","T",",","D_out_enc",")","-","memory",":","(","B",",","T_mel",",","D_mel",")","-","outputs",":","(","B",",","T_mel",",","D_mel",")","-","alignments",":","(","B",",","T_in",",","T_out",")","-","stop_tokens",":","(","B",",","T_out",")"]
code: def forward(self, inputs, memories, mask):
      r"""Train Decoder with teacher forcing.
      Args:
          inputs: Encoder outputs.
          memories: Feature frames for teacher-forcing.
          mask: Attention mask for sequence padding.
  
      Shapes:
          - inputs: (B, T, D_out_enc)
          - memory: (B, T_mel, D_mel)
          - outputs: (B, T_mel, D_mel)
          - alignments: (B, T_in, T_out)
          - stop_tokens: (B, T_out)
      """
      memory = self.get_go_frame(inputs).unsqueeze(0)
      memories = self._reshape_memory(memories)
      memories = torch.cat((memory, memories), dim=0)
      memories = self._update_memory(memories)
      memories = self.prenet(memories)
  
      self._init_states(inputs, mask=mask)
      self.attention.init_states(inputs)
  
      outputs, stop_tokens, alignments = [], [], []
      while len(outputs) < memories.size(0) - 1:
          memory = memories[len(outputs)]
          decoder_output, attention_weights, stop_token = self.decode(
              memory
          )
          outputs += [decoder_output.squeeze(1)]
          stop_tokens += [stop_token.squeeze(1)]
          alignments += [attention_weights]
  
      outputs, stop_tokens, alignments = self._parse_outputs(
          outputs, stop_tokens, alignments
      )
      return outputs, alignments, stop_tokens
  
imports: import torch
  from torch import nn
  from torch.nn import functional
  from .common_layers import Prenet, Linear
  from .attentions import init_attn
label_desc: Use image node_id 9 for calling the Decoder obj's underlying member method code with example usage: obj.forward(inputs, memories, mask) and returns: outputs,  alignments,  stop_tokens