class_docstr: Pitch or Mel decoder module in VISinger 2.
docstr: Forward pass of the Decoder.
  
  Args:
      x (Tensor): Input tensor (B, 2 + attention_dim, T).
      x_lengths (Tensor): Length tensor (B,).
      g (Tensor, optional): Global conditioning tensor (B, global_channels, 1).
  
  Returns:
      Tensor: Output tensor (B, 1, T).
      Tensor: Output mask (B, 1, T).
docstr_tok: ["Forward","pass","of","the","Decoder",".","Args",":","x","(","Tensor",")",":","Input","tensor","(","B",",","2","+","attention_dim",",","T",")",".","x_lengths","(","Tensor",")",":","Length","tensor","(","B",",",")",".","g","(","Tensor",",","optional",")",":","Global","conditioning","tensor","(","B",",","global_channels",",","1",")",".","Returns",":","Tensor",":","Output","tensor","(","B",",","1",",","T",")",".","Tensor",":","Output","mask","(","B",",","1",",","T",")","."]
code: def forward(self, x, x_lengths, g=None):
      """
      Forward pass of the Decoder.
  
      Args:
          x (Tensor): Input tensor (B, 2 + attention_dim, T).
          x_lengths (Tensor): Length tensor (B,).
          g (Tensor, optional): Global conditioning tensor (B, global_channels, 1).
  
      Returns:
          Tensor: Output tensor (B, 1, T).
          Tensor: Output mask (B, 1, T).
      """
  
      x_mask = (
          make_non_pad_mask(x_lengths)
          .to(
              device=x.device,
              dtype=x.dtype,
          )
          .unsqueeze(1)
      )
      x = self.prenet(x) * x_mask
  
      if g is not None:
          x = x + self.global_conv(g)
  
      x = x.transpose(1, 2)
      x, _ = self.decoder(x, x_mask)
      x = x.transpose(1, 2)
  
      x = self.proj(x) * x_mask
  
      return x, x_mask
  
imports: import torch
  from espnet.nets.pytorch_backend.conformer.encoder import Encoder
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
label_desc: Use image node_id 2 for calling the Decoder obj's underlying member method code with example usage: obj.forward(x, x_lengths, g) and returns: x,  x_mask