class_docstr: Residual block module in WaveNet.
class_docstr_tok: ["Residual","block","module","in","WaveNet","."]
docstr: Calculate forward propagation.
  
  Args:
      x (Tensor): Input tensor (B, residual_channels, T).
      x_mask Optional[torch.Tensor]: Mask tensor (B, 1, T).
      c (Optional[Tensor]): Local conditioning tensor (B, aux_channels, T).
      g (Optional[Tensor]): Global conditioning tensor (B, global_channels, 1).
  
  Returns:
      Tensor: Output tensor for residual connection (B, residual_channels, T).
      Tensor: Output tensor for skip connection (B, skip_channels, T).
docstr_tok: ["Calculate","forward","propagation",".","Args",":","x","(","Tensor",")",":","Input","tensor","(","B",",","residual_channels",",","T",")",".","x_mask","Optional","[","torch.Tensor","]",":","Mask","tensor","(","B",",","1",",","T",")",".","c","(","Optional","[","Tensor","]",")",":","Local","conditioning","tensor","(","B",",","aux_channels",",","T",")",".","g","(","Optional","[","Tensor","]",")",":","Global","conditioning","tensor","(","B",",","global_channels",",","1",")",".","Returns",":","Tensor",":","Output","tensor","for","residual","connection","(","B",",","residual_channels",",","T",")",".","Tensor",":","Output","tensor","for","skip","connection","(","B",",","skip_channels",",","T",")","."]
code: def forward(
      self,
      x: torch.Tensor,
      x_mask: Optional[torch.Tensor] = None,
      c: Optional[torch.Tensor] = None,
      g: Optional[torch.Tensor] = None,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Calculate forward propagation.
  
      Args:
          x (Tensor): Input tensor (B, residual_channels, T).
          x_mask Optional[torch.Tensor]: Mask tensor (B, 1, T).
          c (Optional[Tensor]): Local conditioning tensor (B, aux_channels, T).
          g (Optional[Tensor]): Global conditioning tensor (B, global_channels, 1).
  
      Returns:
          Tensor: Output tensor for residual connection (B, residual_channels, T).
          Tensor: Output tensor for skip connection (B, skip_channels, T).
  
      """
      residual = x
      x = F.dropout(x, p=self.dropout_rate, training=self.training)
      x = self.conv(x)
  
      # split into two part for gated activation
      splitdim = 1
      xa, xb = x.split(x.size(splitdim) // 2, dim=splitdim)
  
      # local conditioning
      if c is not None:
          c = self.conv1x1_aux(c)
          ca, cb = c.split(c.size(splitdim) // 2, dim=splitdim)
          xa, xb = xa + ca, xb + cb
  
      # global conditioning
      if g is not None:
          g = self.conv1x1_glo(g)
          ga, gb = g.split(g.size(splitdim) // 2, dim=splitdim)
          xa, xb = xa + ga, xb + gb
  
      x = torch.tanh(xa) * torch.sigmoid(xb)
  
      # residual + skip 1x1 conv
      x = self.conv1x1_out(x)
      if x_mask is not None:
          x = x * x_mask
  
      # split integrated conv results
      x, s = x.split(
          [self.residual_channels, self.skip_channels], dim=1
      )
  
      # for residual connection
      x = x + residual
      if self.scale_residual:
          x = x * math.sqrt(0.5)
  
      return x, s
  
file_path: espnet/espnet2/gan_tts/wavenet/residual_block.py
imports: import math
  from typing import Optional, Tuple
  import torch
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the ResidualBlock obj's underlying member method code with example usage: obj.forward(x, x_mask, c, g) and returns: x,  s