class_docstr: Translatotron2 module.
  
  This is a module of the synthesizer in Translatotron2 described in `Translatotron 2:
  High-quality direct speech-to-speech translation with voice preservation`_.
  
  .. _`Translatotron 2:
  High-quality direct speech-to-speech translation with voice preservation`:
      https://arxiv.org/pdf/2107.08661v5.pdf
class_docstr_tok: ["Translatotron2","module",".","This","is","a","module","of","the","synthesizer","in","Translatotron2","described","in","`","Translatotron","2",":","High-quality","direct","speech-to-speech","translation","with","voice","preservation","`","_",".","..","_","`","Translatotron","2",":","High-quality","direct","speech-to-speech","translation","with","voice","preservation","`",":","https",":","\/\/arxiv.org\/pdf\/2107.08661v5.pdf"]
code: def __init__(
      self,
      # network structure related
      idim: int,
      odim: int,
      synthesizer_type: str = "rnn",
      layers: int = 2,
      units: int = 1024,
      # for prenet
      prenet_layers: int = 2,
      prenet_units: int = 128,
      prenet_dropout_rate: float = 0.5,
      # for postnet
      postnet_layers: int = 5,
      postnet_chans: int = 512,
      postnet_dropout_rate: float = 0.5,
      # for transformer
      adim: int = 384,
      aheads: int = 4,
      # only for conformer
      conformer_rel_pos_type: str = "legacy",
      conformer_pos_enc_layer_type: str = "rel_pos",
      conformer_self_attn_layer_type: str = "rel_selfattn",
      conformer_activation_type: str = "swish",
      use_macaron_style_in_conformer: bool = True,
      use_cnn_in_conformer: bool = True,
      zero_triu: bool = False,
      conformer_enc_kernel_size: int = 7,
      conformer_dec_kernel_size: int = 31,
      # duration predictor
      duration_predictor_layers: int = 2,
      duration_predictor_type: str = "rnn",
      duration_predictor_units: int = 128,
      # extra embedding related
      spks: Optional[int] = None,
      langs: Optional[int] = None,
      spk_embed_dim: Optional[int] = None,
      spk_embed_integration_type: str = "add",
      # training related
      init_type: str = "xavier_uniform",
      init_enc_alpha: float = 1.0,
      init_dec_alpha: float = 1.0,
      use_masking: bool = False,
      use_weighted_masking: bool = False,
  ):
      return
  
imports: import logging
  from typing import Dict, Optional, Sequence, Tuple
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.s2st.synthesizer.abs_synthesizer import AbsSynthesizer
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.torch_utils.initialize import initialize
  from espnet2.tts.fastspeech2.loss import FastSpeech2Loss
  from espnet2.tts.fastspeech2.variance_predictor import VariancePredictor
  from espnet2.tts.gst.style_encoder import StyleEncoder
  from espnet.nets.pytorch_backend.conformer.encoder import Encoder
  from espnet.nets.pytorch_backend.fastspeech.duration_predictor import DurationPredictor
  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.embedding import PositionalEncoding, ScaledPositionalEncoding
  from espnet.nets.pytorch_backend.transformer.encoder import Encoder
label_desc: Use image node_id 1 to create a new Translatotron2 object from inherited base classes: AbsSynthesizer with example: obj = Translatotron2(idim, odim, synthesizer_type, layers, units, prenet_layers, prenet_units, prenet_dropout_rate, postnet_layers, postnet_chans, postnet_dropout_rate, adim, aheads, conformer_rel_pos_type, conformer_pos_enc_layer_type, conformer__attn_layer_type, conformer_activation_type, use_macaron_style_in_conformer, use_cnn_in_conformer, zero_triu, conformer_enc_kernel_size, conformer_dec_kernel_size, duration_predictor_layers, duration_predictor_type, duration_predictor_units, spks, langs, spk_embed_dim, spk_embed_integration_type, init_type, init_enc_alpha, init_dec_alpha, use_masking, use_weighted_masking)