class_docstr: Loss function module for Tacotron2.
class_docstr_tok: ["Loss","function","module","for","Tacotron2","."]
docstr: Initialize Tactoron2 loss module.
  
  Args:
      use_masking (bool): Whether to apply masking
          for padded part in loss calculation.
      use_weighted_masking (bool):
          Whether to apply weighted masking in loss calculation.
docstr_tok: ["Initialize","Tactoron2","loss","module",".","Args",":","use_masking","(","bool",")",":","Whether","to","apply","masking","for","padded","part","in","loss","calculation",".","use_weighted_masking","(","bool",")",":","Whether","to","apply","weighted","masking","in","loss","calculation","."]
code: def __init__(self, use_masking=True, use_weighted_masking=False):
      """Initialize Tactoron2 loss module.
  
      Args:
          use_masking (bool): Whether to apply masking
              for padded part in loss calculation.
          use_weighted_masking (bool):
              Whether to apply weighted masking in loss calculation.
      """
      super(NaiveRNNLoss, self).__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)
  
imports: from typing import Dict, Optional, Tuple
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.svs.abs_svs import AbsSVS
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.torch_utils.initialize import initialize
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
  from espnet.nets.pytorch_backend.tacotron2.decoder import Postnet
  from espnet.nets.pytorch_backend.tacotron2.encoder import Encoder
label_desc: Use image node_id 1 to create a new NaiveRNNLoss object from inherited base classes: torch.nn with example: obj = NaiveRNNLoss(use_masking, use_weighted_masking)