class_docstr: Discriminator adversarial loss module.
class_docstr_tok: ["Discriminator","adversarial","loss","module","."]
docstr: Calcualate discriminator adversarial loss.
  
  Args:
      outputs_hat (Union[List[List[Tensor]], List[Tensor], Tensor]): Discriminator
          outputs, list of discriminator outputs, or list of list of discriminator
          outputs calculated from generator.
      outputs (Union[List[List[Tensor]], List[Tensor], Tensor]): Discriminator
          outputs, list of discriminator outputs, or list of list of discriminator
          outputs calculated from groundtruth.
  
  Returns:
      Tensor: Discriminator real loss value.
      Tensor: Discriminator fake loss value.
docstr_tok: ["Calcualate","discriminator","adversarial","loss",".","Args",":","outputs_hat","(","Union","[","List","[","List","[","Tensor","]","]",",","List","[","Tensor","]",",","Tensor","]",")",":","Discriminator","outputs",",","list","of","discriminator","outputs",",","or","list","of","list","of","discriminator","outputs","calculated","from","generator",".","outputs","(","Union","[","List","[","List","[","Tensor","]","]",",","List","[","Tensor","]",",","Tensor","]",")",":","Discriminator","outputs",",","list","of","discriminator","outputs",",","or","list","of","list","of","discriminator","outputs","calculated","from","groundtruth",".","Returns",":","Tensor",":","Discriminator","real","loss","value",".","Tensor",":","Discriminator","fake","loss","value","."]
code: def forward(
      self,
      outputs_hat: Union[
          List[List[torch.Tensor]], List[torch.Tensor], torch.Tensor
      ],
      outputs: Union[
          List[List[torch.Tensor]], List[torch.Tensor], torch.Tensor
      ],
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Calcualate discriminator adversarial loss.
  
      Args:
          outputs_hat (Union[List[List[Tensor]], List[Tensor], Tensor]): Discriminator
              outputs, list of discriminator outputs, or list of list of discriminator
              outputs calculated from generator.
          outputs (Union[List[List[Tensor]], List[Tensor], Tensor]): Discriminator
              outputs, list of discriminator outputs, or list of list of discriminator
              outputs calculated from groundtruth.
  
      Returns:
          Tensor: Discriminator real loss value.
          Tensor: Discriminator fake loss value.
  
      """
      if isinstance(outputs, (tuple, list)):
          real_loss = 0.0
          fake_loss = 0.0
          for i, (outputs_hat_, outputs_) in enumerate(
              zip(outputs_hat, outputs)
          ):
              if isinstance(outputs_hat_, (tuple, list)):
                  # NOTE(kan-bayashi): case including feature maps
                  outputs_hat_ = outputs_hat_[-1]
                  outputs_ = outputs_[-1]
              real_loss += self.real_criterion(outputs_)
              fake_loss += self.fake_criterion(outputs_hat_)
          if self.average_by_discriminators:
              fake_loss /= i + 1
              real_loss /= i + 1
      else:
          real_loss = self.real_criterion(outputs)
          fake_loss = self.fake_criterion(outputs_hat)
  
      return real_loss, fake_loss
  
imports: from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from espnet2.tts.feats_extract.log_mel_fbank import LogMelFbank
label_desc: Use image node_id 2 for calling the DiscriminatorAdversarialLoss obj's underlying member method code with example usage: obj.forward(outputs_hat, outputs) and returns: real_loss,  fake_loss