class_docstr: Feed Forward Transformer for TTS a.k.a. FastSpeech.
  
  This is a module of FastSpeech,
  feed-forward Transformer with duration predictor described in
  `FastSpeech: Fast, Robust and Controllable Text to Speech`_,
  which does not require any auto-regressive
  processing during inference,
  resulting in fast decoding compared with auto-regressive Transformer.
  
  .. _`FastSpeech: Fast, Robust and Controllable Text to Speech`:
      https://arxiv.org/pdf/1905.09263.pdf
class_docstr_tok: ["Feed","Forward","Transformer","for","TTS","a.k.a",".","FastSpeech",".","This","is","a","module","of","FastSpeech",",","feed-forward","Transformer","with","duration","predictor","described","in","`","FastSpeech",":","Fast",",","Robust","and","Controllable","Text","to","Speech","`","_",",","which","does","not","require","any","auto-regressive","processing","during","inference",",","resulting","in","fast","decoding","compared","with","auto-regressive","Transformer",".","..","_","`","FastSpeech",":","Fast",",","Robust","and","Controllable","Text","to","Speech","`",":","https",":","\/\/arxiv.org\/pdf\/1905.09263.pdf"]
docstr: Calculate forward propagation.
  
  Args:
      xs (Tensor): Batch of padded character ids (B, Tmax).
      ilens (LongTensor): Batch of lengths of each input batch (B,).
      ys (Tensor): Batch of padded target features (B, Lmax, odim).
      olens (LongTensor): Batch of the lengths of each target (B,).
      spembs (Tensor, optional):
          Batch of speaker embedding vectors (B, spk_embed_dim).
      extras (Tensor, optional): Batch of precalculated durations (B, Tmax, 1).
  
  Returns:
      Tensor: Loss value.
docstr_tok: ["Calculate","forward","propagation",".","Args",":","xs","(","Tensor",")",":","Batch","of","padded","character","ids","(","B",",","Tmax",")",".","ilens","(","LongTensor",")",":","Batch","of","lengths","of","each","input","batch","(","B",",",")",".","ys","(","Tensor",")",":","Batch","of","padded","target","features","(","B",",","Lmax",",","odim",")",".","olens","(","LongTensor",")",":","Batch","of","the","lengths","of","each","target","(","B",",",")",".","spembs","(","Tensor",",","optional",")",":","Batch","of","speaker","embedding","vectors","(","B",",","spk_embed_dim",")",".","extras","(","Tensor",",","optional",")",":","Batch","of","precalculated","durations","(","B",",","Tmax",",","1",")",".","Returns",":","Tensor",":","Loss","value","."]
code: def forward(
      self,
      xs,
      ilens,
      ys,
      olens,
      spembs=None,
      extras=None,
      *args,
      **kwargs,
  ):
      """Calculate forward propagation.
  
      Args:
          xs (Tensor): Batch of padded character ids (B, Tmax).
          ilens (LongTensor): Batch of lengths of each input batch (B,).
          ys (Tensor): Batch of padded target features (B, Lmax, odim).
          olens (LongTensor): Batch of the lengths of each target (B,).
          spembs (Tensor, optional):
              Batch of speaker embedding vectors (B, spk_embed_dim).
          extras (Tensor, optional): Batch of precalculated durations (B, Tmax, 1).
  
      Returns:
          Tensor: Loss value.
  
      """
      # remove unnecessary padded part (for multi-gpus)
      xs = xs[:, : max(ilens)]
      ys = ys[:, : max(olens)]
      if extras is not None:
          extras = extras[:, : max(ilens)].squeeze(-1)
  
      # forward propagation
      before_outs, after_outs, ds, d_outs = self._forward(
          xs,
          ilens,
          ys,
          olens,
          spembs=spembs,
          ds=extras,
          is_inference=False,
      )
  
      # modifiy mod part of groundtruth
      if self.reduction_factor > 1:
          olens = olens.new(
              [olen - olen % self.reduction_factor for olen in olens]
          )
          max_olen = max(olens)
          ys = ys[:, :max_olen]
  
      # calculate loss
      if self.postnet is None:
          l1_loss, duration_loss = self.criterion(
              None, before_outs, d_outs, ys, ds, ilens, olens
          )
      else:
          l1_loss, duration_loss = self.criterion(
              after_outs, before_outs, d_outs, ys, ds, ilens, olens
          )
      loss = l1_loss + duration_loss
      report_keys = [
          {"l1_loss": l1_loss.item()},
          {"duration_loss": duration_loss.item()},
          {"loss": loss.item()},
      ]
  
      # report extra information
      if self.use_scaled_pos_enc:
          report_keys += [
              {
                  "encoder_alpha": self.encoder.embed[
                      -1
                  ].alpha.data.item()
              },
              {
                  "decoder_alpha": self.decoder.embed[
                      -1
                  ].alpha.data.item()
              },
          ]
      self.reporter.report(report_keys)
  
      return loss
  
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 4 for calling the FeedForwardTransformer obj's underlying member method code with example usage: obj.forward(xs, ilens, ys, olens, spembs, extras) and returns: loss