docstr: Forward computations from the waveform batches to the output probabilities.
docstr_tok: ["Forward","computations","from","the","waveform","batches","to","the","output","probabilities","."]
code: def compute_forward(self, batch, stage):
      """Forward computations from the waveform batches to the output probabilities."""
  
      batch = batch.to(self.device)
      wavs, wav_lens = batch.sig  # audio
      tokens_bos, _ = batch.tokens_bos  # translation
  
      # wav2vec module
      feats = self.modules.wav2vec2(wavs, wav_lens)
  
      # dimensionality reduction
      src = self.modules.enc(feats)
  
      # transformer decoder
      if self.distributed_launch:
          dec_out = (
              self.modules.Transformer.module.forward_mt_decoder_only(
                  src, tokens_bos, pad_idx=self.hparams.pad_index
              )
          )
      else:
          dec_out = self.modules.Transformer.forward_mt_decoder_only(
              src, tokens_bos, pad_idx=self.hparams.pad_index
          )
  
      # logits and softmax
      pred = self.modules.seq_lin(dec_out)
      p_seq = self.hparams.log_softmax(pred)
  
      # compute outputs
      hyps = None
      if stage == sb.Stage.VALID:
          # the output of the encoder (enc) is used for valid search
          hyps, _, _, _ = self.hparams.valid_search(
              src.detach(), wav_lens
          )
  
      elif stage == sb.Stage.TEST:
          hyps, _, _, _ = self.hparams.test_search(
              src.detach(), wav_lens
          )
  
      return p_seq, wav_lens, hyps
  
file_path: speechbrain/recipes/IWSLT22_lowresource/AST/transformer/train.py
imports: import sys
  import torch
  import logging
  import speechbrain
  from speechbrain.tokenizers.SentencePiece import SentencePiece
  from speechbrain.utils.distributed import run_on_main
  from hyperpyyaml import load_hyperpyyaml
  from sacremoses import MosesDetokenizer
label_desc: Use image node_id 1 for calling the ST obj's underlying member method code with example usage: obj.compute_forward(batch, stage) and returns: p_seq,  wav_lens,  hyps