class_docstr: UnitY 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).
class_docstr_tok: ["UnitY","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",")","."]
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_last_hidden: bool = False,
      return_all_hiddens: 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_last_hidden=return_last_hidden,
          return_all_hiddens=return_all_hiddens,
      )
  
file_path: espnet/espnet2/s2st/synthesizer/unity_synthesizer.py
imports: import logging
  from typing import Dict, 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
label_desc: Use image node_id 3 for calling the UnitYSynthesizer obj's underlying member method code with example usage: obj._forward(hs, hlens, ys, olens, spembs, sids, lids, return_last_hidden, return_all_hiddens) and returns: self