class_docstr: Loss function module for ProDiffLoss.
class_docstr_tok: ["Loss","function","module","for","ProDiffLoss","."]
docstr: Initialize feed-forward Transformer loss module.
  
  Args:
      use_masking (bool): Whether to apply masking for padded part in loss
          calculation.
      use_weighted_masking (bool): Whether to weighted masking in loss
          calculation.
docstr_tok: ["Initialize","feed-forward","Transformer","loss","module",".","Args",":","use_masking","(","bool",")",":","Whether","to","apply","masking","for","padded","part","in","loss","calculation",".","use_weighted_masking","(","bool",")",":","Whether","to","weighted","masking","in","loss","calculation","."]
code: def __init__(
      self,
      use_masking: bool = True,
      use_weighted_masking: bool = False,
  ):
      """Initialize feed-forward Transformer loss module.
  
      Args:
          use_masking (bool): Whether to apply masking for padded part in loss
              calculation.
          use_weighted_masking (bool): Whether to weighted masking in loss
              calculation.
  
      """
      assert check_argument_types()
      super().__init__()
  
      assert (use_masking != use_weighted_masking) or not use_masking
      self.use_masking = use_masking
      self.use_weighted_masking = use_weighted_masking
  
      # define criterions
      reduction = "none" if self.use_weighted_masking else "mean"
      self.l1_criterion = torch.nn.L1Loss(reduction=reduction)
      self.mse_criterion = torch.nn.MSELoss(reduction=reduction)
      self.duration_criterion = DurationPredictorLoss(
          reduction=reduction
      )
      self.ssim_criterion = SSimLoss(reduction="none")
  
file_path: espnet/espnet2/tts/prodiff/loss.py
imports: from math import exp
  from typing import Tuple
  import torch
  from torch.nn import functional
  from typeguard import check_argument_types
  from espnet.nets.pytorch_backend.fastspeech.duration_predictor import DurationPredictorLoss
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
label_desc: Use image node_id 1 to create a new ProDiffLoss object from inherited base classes: torch.nn with example: obj = ProDiffLoss(use_masking, use_weighted_masking)