docstr: Calculate forward propagation.
  
  Args:
      c (Tensor): Input tensor (B, in_channels, T).
      ddsp (Tensor): Input tensor (B, n_harmonic + 2, T * hop_length).
      g (Optional[Tensor]): Global conditioning tensor (B, global_channels, 1).
  
  Returns:
      Tensor: Output tensor (B, out_channels, T).
code: def forward(
      self, c, ddsp, g: Optional[torch.Tensor] = None
  ) -> torch.Tensor:
      """Calculate forward propagation.
  
      Args:
          c (Tensor): Input tensor (B, in_channels, T).
          ddsp (Tensor): Input tensor (B, n_harmonic + 2, T * hop_length).
          g (Optional[Tensor]): Global conditioning tensor (B, global_channels, 1).
  
      Returns:
          Tensor: Output tensor (B, out_channels, T).
  
      """
  
      c = self.input_conv(c)
      if g is not None:
          c = c + self.global_conv(g)
  
      se = ddsp
      res_features = [se]
      for i in range(self.num_upsamples):
          in_size = se.size(2)
          se = self.downs[i](se)
          se = self.blocks_downs[i](se)
          up_rate = self.upsample_scales[self.num_upsamples - 1 - i]
          se = se[:, :, : in_size // up_rate]
          res_features.append(se)
  
      c = torch.cat([c, se], 1)
      c = self.concat_pre(c)
  
      for i in range(self.num_upsamples):
          in_size = c.size(2)
          c = self.upsamples[i](c)
          c = c[:, :, : in_size * self.upsample_scales[i]]
  
          c = torch.cat(
              [c, res_features[self.num_upsamples - 1 - i]], 1
          )
          c = self.concat_conv[i](c)
  
          cs = 0.0  # initialize
          for j in range(self.num_blocks):
              cs = cs + self.blocks[i * self.num_blocks + j](c)
          c = cs / self.num_blocks
      c = self.output_conv(c)
  
      return c
  
imports: import logging
  import math
  from typing import Any, Dict, List, Optional
  import numpy
  import torch
  import torch.nn.functional
  from espnet2.gan_svs.visinger2.ddsp import remove_above_nyquist, scale_function, upsample
  from espnet2.gan_tts.hifigan import HiFiGANMultiPeriodDiscriminator, HiFiGANMultiScaleDiscriminator, HiFiGANMultiScaleMultiPeriodDiscriminator, HiFiGANPeriodDiscriminator, HiFiGANScaleDiscriminator
  from espnet2.gan_tts.hifigan.residual_block import ResidualBlock
label_desc: Use image node_id 2 for calling the VISinger2VocoderGenerator obj's underlying member method code with example usage: obj.forward(c, ddsp, g) and returns: c