class_docstr: WaveNet with global conditioning.
class_docstr_tok: ["WaveNet","with","global","conditioning","."]
docstr: Calculate forward propagation.
  
  Args:
      x (Tensor): Input noise signal (B, 1, T) if use_first_conv else
          (B, residual_channels, T).
      x_mask (Optional[Tensor]): Mask tensor (B, 1, T).
      c (Optional[Tensor]): Local conditioning features (B, aux_channels, T).
      g (Optional[Tensor]): Global conditioning features (B, global_channels, 1).
  
  Returns:
      Tensor: Output tensor (B, out_channels, T) if use_last_conv else
          (B, residual_channels, T).
docstr_tok: ["Calculate","forward","propagation",".","Args",":","x","(","Tensor",")",":","Input","noise","signal","(","B",",","1",",","T",")","if","use_first_conv","else","(","B",",","residual_channels",",","T",")",".","x_mask","(","Optional","[","Tensor","]",")",":","Mask","tensor","(","B",",","1",",","T",")",".","c","(","Optional","[","Tensor","]",")",":","Local","conditioning","features","(","B",",","aux_channels",",","T",")",".","g","(","Optional","[","Tensor","]",")",":","Global","conditioning","features","(","B",",","global_channels",",","1",")",".","Returns",":","Tensor",":","Output","tensor","(","B",",","out_channels",",","T",")","if","use_last_conv","else","(","B",",","residual_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,
  ) -> torch.Tensor:
      """Calculate forward propagation.
  
      Args:
          x (Tensor): Input noise signal (B, 1, T) if use_first_conv else
              (B, residual_channels, T).
          x_mask (Optional[Tensor]): Mask tensor (B, 1, T).
          c (Optional[Tensor]): Local conditioning features (B, aux_channels, T).
          g (Optional[Tensor]): Global conditioning features (B, global_channels, 1).
  
      Returns:
          Tensor: Output tensor (B, out_channels, T) if use_last_conv else
              (B, residual_channels, T).
  
      """
      # encode to hidden representation
      if self.use_first_conv:
          x = self.first_conv(x)
  
      # residual block
      skips = 0.0
      for f in self.conv_layers:
          x, h = f(x, x_mask=x_mask, c=c, g=g)
          skips = skips + h
      x = skips
      if self.scale_skip_connect:
          x = x * math.sqrt(1.0 / len(self.conv_layers))
  
      # apply final layers
      if self.use_last_conv:
          x = self.last_conv(x)
  
      return x
  
file_path: espnet/espnet2/gan_tts/wavenet/wavenet.py
imports: import logging
  import math
  from typing import Optional
  import torch
  from espnet2.gan_tts.wavenet.residual_block import Conv1d1x1, ResidualBlock
label_desc: Use image node_id 2 for calling the WaveNet obj's underlying member method code with example usage: obj.forward(x, x_mask, c, g) and returns: x