class_docstr: ESPnet model for text-to-speech task.
docstr: Caclualte features and return them as a dict.
  
  Args:
      text (Tensor): Text index tensor (B, T_text).
      text_lengths (Tensor): Text length tensor (B,).
      speech (Tensor): Speech waveform tensor (B, T_wav).
      speech_lengths (Tensor): Speech length tensor (B,).
      durations (Optional[Tensor): Duration tensor.
      durations_lengths (Optional[Tensor): Duration length tensor (B,).
      pitch (Optional[Tensor): Pitch tensor.
      pitch_lengths (Optional[Tensor): Pitch length tensor (B,).
      energy (Optional[Tensor): Energy tensor.
      energy_lengths (Optional[Tensor): Energy length tensor (B,).
      spembs (Optional[Tensor]): Speaker embedding tensor (B, D).
      sids (Optional[Tensor]): Speaker ID tensor (B, 1).
      lids (Optional[Tensor]): Language ID tensor (B, 1).
  
  Returns:
      Dict[str, Tensor]: Dict of features.
docstr_tok: ["Caclualte","features","and","return","them","as","a","dict",".","Args",":","text","(","Tensor",")",":","Text","index","tensor","(","B",",","T_text",")",".","text_lengths","(","Tensor",")",":","Text","length","tensor","(","B",",",")",".","speech","(","Tensor",")",":","Speech","waveform","tensor","(","B",",","T_wav",")",".","speech_lengths","(","Tensor",")",":","Speech","length","tensor","(","B",",",")",".","durations","(","Optional","[","Tensor",")",":","Duration","tensor",".","durations_lengths","(","Optional","[","Tensor",")",":","Duration","length","tensor","(","B",",",")",".","pitch","(","Optional","[","Tensor",")",":","Pitch","tensor",".","pitch_lengths","(","Optional","[","Tensor",")",":","Pitch","length","tensor","(","B",",",")",".","energy","(","Optional","[","Tensor",")",":","Energy","tensor",".","energy_lengths","(","Optional","[","Tensor",")",":","Energy","length","tensor","(","B",",",")",".","spembs","(","Optional","[","Tensor","]",")",":","Speaker","embedding","tensor","(","B",",","D",")",".","sids","(","Optional","[","Tensor","]",")",":","Speaker","ID","tensor","(","B",",","1",")",".","lids","(","Optional","[","Tensor","]",")",":","Language","ID","tensor","(","B",",","1",")",".","Returns",":","Dict","[","str",",","Tensor","]",":","Dict","of","features","."]
code: def collect_feats(
      self,
      text: torch.Tensor,
      text_lengths: torch.Tensor,
      speech: torch.Tensor,
      speech_lengths: torch.Tensor,
      durations: Optional[torch.Tensor] = None,
      durations_lengths: Optional[torch.Tensor] = None,
      pitch: Optional[torch.Tensor] = None,
      pitch_lengths: Optional[torch.Tensor] = None,
      energy: Optional[torch.Tensor] = None,
      energy_lengths: Optional[torch.Tensor] = None,
      spembs: Optional[torch.Tensor] = None,
      sids: Optional[torch.Tensor] = None,
      lids: Optional[torch.Tensor] = None,
      **kwargs,
  ) -> Dict[str, torch.Tensor]:
      """Caclualte features and return them as a dict.
  
      Args:
          text (Tensor): Text index tensor (B, T_text).
          text_lengths (Tensor): Text length tensor (B,).
          speech (Tensor): Speech waveform tensor (B, T_wav).
          speech_lengths (Tensor): Speech length tensor (B,).
          durations (Optional[Tensor): Duration tensor.
          durations_lengths (Optional[Tensor): Duration length tensor (B,).
          pitch (Optional[Tensor): Pitch tensor.
          pitch_lengths (Optional[Tensor): Pitch length tensor (B,).
          energy (Optional[Tensor): Energy tensor.
          energy_lengths (Optional[Tensor): Energy length tensor (B,).
          spembs (Optional[Tensor]): Speaker embedding tensor (B, D).
          sids (Optional[Tensor]): Speaker ID tensor (B, 1).
          lids (Optional[Tensor]): Language ID tensor (B, 1).
  
      Returns:
          Dict[str, Tensor]: Dict of features.
  
      """
      # feature extraction
      if self.feats_extract is not None:
          feats, feats_lengths = self.feats_extract(
              speech, speech_lengths
          )
      else:
          # Use precalculated feats (feats_type != raw case)
          feats, feats_lengths = speech, speech_lengths
      if self.pitch_extract is not None:
          pitch, pitch_lengths = self.pitch_extract(
              speech,
              speech_lengths,
              feats_lengths=feats_lengths,
              durations=durations,
              durations_lengths=durations_lengths,
          )
      if self.energy_extract is not None:
          energy, energy_lengths = self.energy_extract(
              speech,
              speech_lengths,
              feats_lengths=feats_lengths,
              durations=durations,
              durations_lengths=durations_lengths,
          )
  
      # store in dict
      feats_dict = dict(feats=feats, feats_lengths=feats_lengths)
      if pitch is not None:
          feats_dict.update(pitch=pitch, pitch_lengths=pitch_lengths)
      if energy is not None:
          feats_dict.update(
              energy=energy, energy_lengths=energy_lengths
          )
  
      return feats_dict
  
file_path: espnet/espnet2/tts/espnet_model.py
imports: from contextlib import contextmanager
  from typing import Dict, Optional, Tuple
  import torch
  from packaging.version import parse
  from typeguard import check_argument_types
  from espnet2.layers.abs_normalize import AbsNormalize
  from espnet2.layers.inversible_interface import InversibleInterface
  from espnet2.train.abs_espnet_model import AbsESPnetModel
  from espnet2.tts.abs_tts import AbsTTS
  from espnet2.tts.feats_extract.abs_feats_extract import AbsFeatsExtract
label_desc: Use image node_id 3 for calling the ESPnetTTSModel obj's underlying member method code with example usage: obj.collect_feats(text, text_lengths, speech, speech_lengths, durations, durations_lengths, pitch, pitch_lengths, energy, energy_lengths, spembs, sids, lids) and returns: feats_dict