class_docstr: Direct speech-to-speech translation model with Conformer encoder + MT Transformer decoder + TTS Transformer decoder
class_docstr_tok: ["Direct","speech-to-speech","translation","model","with","Conformer","encoder","+","MT","Transformer","decoder","+","TTS","Transformer","decoder"]
code: def forward(
      self,
      src_tokens,
      src_lengths,
      prev_output_tokens,
      prev_output_tokens_mt,
      tgt_speaker=None,
      incremental_state=None,
      target_lengths=None,
      speaker=None,
      return_all_hiddens=False,
  ):
      encoder_out = self.encoder(
          src_tokens,
          src_lengths=src_lengths,
          tgt_speaker=tgt_speaker,
          return_all_hiddens=return_all_hiddens,
      )
  
      # 1. MT decoder
      mt_decoder = getattr(self, f"{self.mt_task_name}_decoder")
      mt_decoder_out = mt_decoder(
          prev_output_tokens_mt,
          encoder_out=encoder_out,
      )
      x = mt_decoder_out[1]["inner_states"][-1]
      if mt_decoder.layer_norm is not None:
          x = mt_decoder.layer_norm(x)
  
      mt_decoder_padding_mask = None
      if prev_output_tokens_mt.eq(mt_decoder.padding_idx).any():
          mt_decoder_padding_mask = prev_output_tokens_mt.eq(
              mt_decoder.padding_idx
          )
  
      # 2. TTS encoder
      if self.synthesizer_encoder is not None:
          tts_encoder_out = self.synthesizer_encoder(
              x,
              mt_decoder_padding_mask,
              return_all_hiddens=return_all_hiddens,
          )
      else:
          tts_encoder_out = {
              "encoder_out": [x],  # T x B x C
              "encoder_padding_mask": [
                  mt_decoder_padding_mask
              ],  # B x T
          }
  
      # 3. TTS decoder
      decoder_out = self.decoder(
          prev_output_tokens,
          encoder_out=tts_encoder_out,
          incremental_state=incremental_state,
          target_lengths=target_lengths,
          speaker=speaker,
      )
      if return_all_hiddens:
          decoder_out[-1]["encoder_states"] = encoder_out[
              "encoder_states"
          ]
          decoder_out[-1]["encoder_padding_mask"] = encoder_out[
              "encoder_padding_mask"
          ]
      decoder_out[-1]["mt_decoder_out"] = mt_decoder_out
      return decoder_out
  
file_path: fairseq/fairseq/models/speech_to_speech/s2s_conformer_translatotron2.py
imports: import copy
  import logging
  from fairseq.models import FairseqEncoderModel, FairseqLanguageModel, register_model, register_model_architecture
  from fairseq.models.speech_to_speech.modules.ctc_decoder import CTCDecoder
  from fairseq.models.speech_to_speech.modules.transformer_encoder import TransformerEncoderNoEmb
  from fairseq.models.speech_to_speech.s2s_conformer import S2SpecTConformerModel
  from fairseq.models.speech_to_speech.s2s_conformer_unity import multitask_text_transformer_decoder_arch
  from fairseq.models.speech_to_speech.s2s_transformer import base_multitask_text_transformer_decoder_arch, s2spect_architecture_base
  from fairseq.models.text_to_speech import TTSTransformerDecoder
  from fairseq.models.transformer import TransformerDecoder, TransformerModelBase
label_desc: Use image node_id 6 for calling the S2SpecT2ConformerModel obj's underlying member method code with example usage: obj.forward(src_tokens, src_lengths, prev_output_tokens, prev_output_tokens_mt, tgt_speaker, incremental_state, target_lengths, speaker, return_all_hiddens) and returns: decoder_out