class_docstr: Discrete unit Synthesizer related modules for speech-to-speech translation.
  
  This is a module of discrete unit prediction network in discrete-unit described
  in `Direct speech-to-speech translation with discrete units`_,
  which converts the sequence of hidden states into the sequence of
  discrete unit (from SSLs).
  
  .. _`Direct speech-to-speech translation with discrete units`:
     https://arxiv.org/abs/2107.05604
code: def _forward(
      self,
      hs: torch.Tensor,
      hlens: torch.Tensor,
      ys: torch.Tensor,
      olens: torch.Tensor,
      spembs: torch.Tensor,
      sids: torch.Tensor,
      lids: torch.Tensor,
      return_hs: bool = False,
      return_all_hs: bool = False,
  ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
      if self.spks is not None:
          sid_embs = self.sid_emb(sids.view(-1))
          hs = hs + sid_embs.unsqueeze(1)
      if self.langs is not None:
          lid_embs = self.lid_emb(lids.view(-1))
          hs = hs + lid_embs.unsqueeze(1)
      if self.spk_embed_dim is not None:
          hs = self._integrate_with_spk_embed(hs, spembs)
      return self.decoder(
          hs,
          hlens,
          ys,
          olens,
          return_hs=return_hs,
          return_all_hs=return_all_hs,
      )
  
imports: import logging
  from typing import Any, Dict, List, Optional, Sequence, Tuple
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.asr.decoder.transformer_decoder import TransformerDecoder
  from espnet2.s2st.synthesizer.abs_synthesizer import AbsSynthesizer
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding
  from espnet.nets.pytorch_backend.transformer.mask import subsequent_mask
  from espnet.nets.scorer_interface import BatchScorerInterface
label_desc: Use image node_id 3 for calling the TransformerDiscreteSynthesizer obj's underlying member method code with example usage: obj._forward(hs, hlens, ys, olens, spembs, sids, lids, return_hs, return_all_hs) and returns: self