def forward(self, text: torch.Tensor, text_lengths: torch.Tensor, speech: torch.Tensor, speech_lengths: torch.Tensor, spembs: Optional[torch.Tensor]=None, sids: Optional[torch.Tensor]=None, lids: Optional[torch.Tensor]=None, forward_generator: bool=True) -> Dict[(str, Any)]:
    'Return generator or discriminator loss with dict format.\n\n        Args:\n            text (Tensor): Text index tensor (B, T_text).\n            text_lengths (Tensor): Text length tensor (B,).\n            speech (Tensor): Speech waveform tensor (B, T_wav).\n            speech_lengths (Tensor): Speech length tensor (B,).\n            spembs (Optional[Tensor]): Speaker embedding tensor (B, D).\n            sids (Optional[Tensor]): Speaker ID tensor (B, 1).\n            lids (Optional[Tensor]): Language ID tensor (B, 1).\n            forward_generator (bool): Whether to forward generator.\n\n        Returns:\n            Dict[str, Any]:\n                - loss (Tensor): Loss scalar tensor.\n                - stats (Dict[str, float]): Statistics to be monitored.\n                - weight (Tensor): Weight tensor to summarize losses.\n                - optim_idx (int): Optimizer index (0 for G and 1 for D).\n\n        '
    with autocast(False):
        feats = None
        if (self.feats_extract is not None):
            (feats, feats_lengths) = self.feats_extract(speech, speech_lengths)
        if (self.normalize is not None):
            (feats, feats_lengths) = self.normalize(feats, feats_lengths)
    batch = {}
    batch.update(text=text, text_lengths=text_lengths)
    batch.update(forward_generator=forward_generator)
    if (feats is not None):
        batch.update(feats=feats, feats_lengths=feats_lengths)
    if self.tts.require_raw_speech:
        batch.update(speech=speech, speech_lengths=speech_lengths)
    if (spembs is not None):
        batch.update(spembs=spembs)
    if (sids is not None):
        batch.update(sids=sids)
    if (lids is not None):
        batch.update(lids=lids)
    return self.tts(**batch)
Return generator or discriminator loss with dict format.

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,).
    spembs (Optional[Tensor]): Speaker embedding tensor (B, D).
    sids (Optional[Tensor]): Speaker ID tensor (B, 1).
    lids (Optional[Tensor]): Language ID tensor (B, 1).
    forward_generator (bool): Whether to forward generator.

Returns:
    Dict[str, Any]:
        - loss (Tensor): Loss scalar tensor.
        - stats (Dict[str, float]): Statistics to be monitored.
        - weight (Tensor): Weight tensor to summarize losses.
        - optim_idx (int): Optimizer index (0 for G and 1 for D).
def forward(self, text: torch.Tensor, text_lengths: torch.Tensor, speech: torch.Tensor, speech_lengths: torch.Tensor, spembs: Optional[torch.Tensor]=None, sids: Optional[torch.Tensor]=None, lids: Optional[torch.Tensor]=None, forward_generator: bool=True) -> Dict[(str, Any)]:
    'Return generator or discriminator loss with dict format.\n\n        Args:\n            text (Tensor): Text index tensor (B, T_text).\n            text_lengths (Tensor): Text length tensor (B,).\n            speech (Tensor): Speech waveform tensor (B, T_wav).\n            speech_lengths (Tensor): Speech length tensor (B,).\n            spembs (Optional[Tensor]): Speaker embedding tensor (B, D).\n            sids (Optional[Tensor]): Speaker ID tensor (B, 1).\n            lids (Optional[Tensor]): Language ID tensor (B, 1).\n            forward_generator (bool): Whether to forward generator.\n\n        Returns:\n            Dict[str, Any]:\n                - loss (Tensor): Loss scalar tensor.\n                - stats (Dict[str, float]): Statistics to be monitored.\n                - weight (Tensor): Weight tensor to summarize losses.\n                - optim_idx (int): Optimizer index (0 for G and 1 for D).\n\n        '
    with autocast(False):
        feats = None
        if (self.feats_extract is not None):
            (feats, feats_lengths) = self.feats_extract(speech, speech_lengths)
        if (self.normalize is not None):
            (feats, feats_lengths) = self.normalize(feats, feats_lengths)
    batch = {}
    batch.update(text=text, text_lengths=text_lengths)
    batch.update(forward_generator=forward_generator)
    if (feats is not None):
        batch.update(feats=feats, feats_lengths=feats_lengths)
    if self.tts.require_raw_speech:
        batch.update(speech=speech, speech_lengths=speech_lengths)
    if (spembs is not None):
        batch.update(spembs=spembs)
    if (sids is not None):
        batch.update(sids=sids)
    if (lids is not None):
        batch.update(lids=lids)
    return self.tts(**batch)