class_docstr: Tacotron2 module for end-to-end text-to-speech (E2E-TTS).
  
  This is a module of Spectrogram prediction network in Tacotron2 described
  in `Natural TTS Synthesis
  by Conditioning WaveNet on Mel Spectrogram Predictions`_,
  which converts the sequence of characters
  into the sequence of Mel-filterbanks.
  
  .. _`Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`:
     https://arxiv.org/abs/1712.05884
class_docstr_tok: ["Tacotron2","module","for","end-to-end","text-to-speech","(","E2E-TTS",")",".","This","is","a","module","of","Spectrogram","prediction","network","in","Tacotron2","described","in","`","Natural","TTS","Synthesis","by","Conditioning","WaveNet","on","Mel","Spectrogram","Predictions","`","_",",","which","converts","the","sequence","of","characters","into","the","sequence","of","Mel-filterbanks",".","..","_","`","Natural","TTS","Synthesis","by","Conditioning","WaveNet","on","Mel","Spectrogram","Predictions","`",":","https",":","\/\/arxiv.org\/abs\/1712.05884"]
docstr: Generate the sequence of features given the sequences of characters.
  
  Args:
      x (Tensor): Input sequence of characters (T,).
      inference_args (Namespace):
          - threshold (float): Threshold in inference.
          - minlenratio (float): Minimum length ratio in inference.
          - maxlenratio (float): Maximum length ratio in inference.
      spemb (Tensor, optional): Speaker embedding vector (spk_embed_dim).
  
  Returns:
      Tensor: Output sequence of features (L, odim).
      Tensor: Output sequence of stop probabilities (L,).
      Tensor: Attention weights (L, T).
docstr_tok: ["Generate","the","sequence","of","features","given","the","sequences","of","characters",".","Args",":","x","(","Tensor",")",":","Input","sequence","of","characters","(","T",",",")",".","inference_args","(","Namespace",")",":","-","threshold","(","float",")",":","Threshold","in","inference",".","-","minlenratio","(","float",")",":","Minimum","length","ratio","in","inference",".","-","maxlenratio","(","float",")",":","Maximum","length","ratio","in","inference",".","spemb","(","Tensor",",","optional",")",":","Speaker","embedding","vector","(","spk_embed_dim",")",".","Returns",":","Tensor",":","Output","sequence","of","features","(","L",",","odim",")",".","Tensor",":","Output","sequence","of","stop","probabilities","(","L",",",")",".","Tensor",":","Attention","weights","(","L",",","T",")","."]
code: def inference(self, x, inference_args, spemb=None, *args, **kwargs):
      """Generate the sequence of features given the sequences of characters.
  
      Args:
          x (Tensor): Input sequence of characters (T,).
          inference_args (Namespace):
              - threshold (float): Threshold in inference.
              - minlenratio (float): Minimum length ratio in inference.
              - maxlenratio (float): Maximum length ratio in inference.
          spemb (Tensor, optional): Speaker embedding vector (spk_embed_dim).
  
      Returns:
          Tensor: Output sequence of features (L, odim).
          Tensor: Output sequence of stop probabilities (L,).
          Tensor: Attention weights (L, T).
  
      """
      # get options
      threshold = inference_args.threshold
      minlenratio = inference_args.minlenratio
      maxlenratio = inference_args.maxlenratio
      use_att_constraint = getattr(
          inference_args, "use_att_constraint", False
      )  # keep compatibility
      backward_window = (
          inference_args.backward_window if use_att_constraint else 0
      )
      forward_window = (
          inference_args.forward_window if use_att_constraint else 0
      )
  
      # inference
      h = self.enc.inference(x)
      if self.spk_embed_dim is not None:
          spemb = (
              F.normalize(spemb, dim=0)
              .unsqueeze(0)
              .expand(h.size(0), -1)
          )
          h = torch.cat([h, spemb], dim=-1)
      outs, probs, att_ws = self.dec.inference(
          h,
          threshold,
          minlenratio,
          maxlenratio,
          use_att_constraint=use_att_constraint,
          backward_window=backward_window,
          forward_window=forward_window,
      )
  
      if self.use_cbhg:
          cbhg_outs = self.cbhg.inference(outs)
          return cbhg_outs, probs, att_ws
      else:
          return outs, probs, att_ws
  
imports: import logging
  import numpy
  import torch
  import torch.nn.functional
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
  from espnet.nets.pytorch_backend.rnn.attentions import AttForward, AttForwardTA, AttLoc
  from espnet.nets.pytorch_backend.tacotron2.cbhg import CBHG, CBHGLoss
  from espnet.nets.pytorch_backend.tacotron2.decoder import Decoder
  from espnet.nets.pytorch_backend.tacotron2.encoder import Encoder
  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 Tacotron2 obj's underlying member method code with example usage: obj.inference(x, inference_args, spemb) and returns: cbhg_outs,  probs,  att_ws, outs,  probs,  att_ws