docstr: Generate harmonics from F0 and harmonic data.
  
  Args:
      f0 (Tensor): Pitch (F0) tensor (B, 1, T).
      harm (Tensor): Harmonic data tensor (B, hidden_channels, T).
      mask (Tensor): Mask tensor for harmonic data (B, 1, T).
  
  Returns:
      Tensor: Harmonic signal tensor (B, n_harmonic, T * hop_length).
code: def forward(self, f0, harm, mask):
      """Generate harmonics from F0 and harmonic data.
  
      Args:
          f0 (Tensor): Pitch (F0) tensor (B, 1, T).
          harm (Tensor): Harmonic data tensor (B, hidden_channels, T).
          mask (Tensor): Mask tensor for harmonic data (B, 1, T).
  
      Returns:
          Tensor: Harmonic signal tensor (B, n_harmonic, T * hop_length).
  
      """
  
      pitch = f0.transpose(1, 2)
      harm = self.prenet(harm)
  
      harm = self.net(harm) * mask
  
      harm = self.postnet(harm)
      harm = harm.transpose(1, 2)
      param = harm
  
      param = scale_function(param)
      total_amp = param[..., :1]
      amplitudes = param[..., 1:]
      amplitudes = remove_above_nyquist(
          amplitudes,
          pitch,
          self.sample_rate,
      )
      amplitudes /= amplitudes.sum(-1, keepdim=True)
      amplitudes *= total_amp
  
      amplitudes = upsample(amplitudes, self.hop_size)
      pitch = upsample(pitch, self.hop_size)
  
      n_harmonic = amplitudes.shape[-1]
      omega = torch.cumsum(2 * math.pi * pitch / self.sample_rate, 1)
      omegas = omega * torch.arange(1, n_harmonic + 1).to(omega)
      signal_harmonics = torch.sin(omegas) * amplitudes
      signal_harmonics = signal_harmonics.transpose(1, 2)
  
      return signal_harmonics
  
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 Generator_Harm obj's underlying member method code with example usage: obj.forward(f0, harm, mask) and returns: signal_harmonics