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"]
code: def _forward(
      self,
      xs,
      ilens,
      ys=None,
      olens=None,
      spembs=None,
      ds=None,
      is_inference=False,
      alpha=1.0,
  ):
      # forward encoder
      x_masks = self._source_mask(ilens).to(xs.device)
      hs, _ = self.encoder(xs, x_masks)  # (B, Tmax, adim)
  
      # integrate speaker embedding
      if self.spk_embed_dim is not None:
          hs = self._integrate_with_spk_embed(hs, spembs)
  
      # forward duration predictor and length regulator
      d_masks = make_pad_mask(ilens).to(xs.device)
      if is_inference:
          d_outs = self.duration_predictor.inference(
              hs, d_masks
          )  # (B, Tmax)
          hs = self.length_regulator(
              hs, d_outs, alpha
          )  # (B, Lmax, adim)
      else:
          if ds is None:
              with torch.no_grad():
                  ds = self.duration_calculator(
                      xs, ilens, ys, olens, spembs
                  )  # (B, Tmax)
          d_outs = self.duration_predictor(hs, d_masks)  # (B, Tmax)
          hs = self.length_regulator(hs, ds)  # (B, Lmax, adim)
  
      # forward decoder
      if olens is not None:
          if self.reduction_factor > 1:
              olens_in = olens.new(
                  [olen // self.reduction_factor for olen in olens]
              )
          else:
              olens_in = olens
          h_masks = self._source_mask(olens_in).to(xs.device)
      else:
          h_masks = None
      zs, _ = self.decoder(hs, h_masks)  # (B, Lmax, adim)
      before_outs = self.feat_out(zs).view(
          zs.size(0), -1, self.odim
      )  # (B, Lmax, odim)
  
      # postnet -> (B, Lmax//r * r, odim)
      if self.postnet is None:
          after_outs = before_outs
      else:
          after_outs = before_outs + self.postnet(
              before_outs.transpose(1, 2)
          ).transpose(1, 2)
  
      if is_inference:
          return before_outs, after_outs, d_outs
      else:
          return before_outs, after_outs, ds, d_outs
  
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 3 for calling the FeedForwardTransformer obj's underlying member method code with example usage: obj._forward(xs, ilens, ys, olens, spembs, ds, is_inference, alpha) and returns: before_outs,  after_outs,  d_outs, before_outs,  after_outs,  ds,  d_outs