class_docstr: Loss function module for feed-forward Transformer.
class_docstr_tok: ["Loss","function","module","for","feed-forward","Transformer","."]
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=True, use_weighted_masking=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.
  
      """
      super(FeedForwardTransformerLoss, 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.duration_criterion = DurationPredictorLoss(
          reduction=reduction
      )
  
imports: import logging
  import torch
  import torch.nn.functional
  from espnet.asr.asr_utils import get_model_conf, torch_load
  from espnet.nets.pytorch_backend.fastspeech.duration_calculator import DurationCalculator
  from espnet.nets.pytorch_backend.fastspeech.duration_predictor import DurationPredictor, DurationPredictorLoss
  from espnet.nets.pytorch_backend.fastspeech.length_regulator import LengthRegulator
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask, make_pad_mask
  from espnet.nets.pytorch_backend.tacotron2.decoder import Postnet
  from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding, ScaledPositionalEncoding
  from espnet.nets.pytorch_backend.transformer.encoder import Encoder
  from espnet.nets.pytorch_backend.transformer.initializer import initialize
  from espnet.nets.tts_interface import TTSInterface
  from espnet.utils.cli_utils import strtobool
  from espnet.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 1 to create a new FeedForwardTransformerLoss object from inherited base classes: torch.nn with example: obj = FeedForwardTransformerLoss(use_masking, use_weighted_masking)