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
  
      src = self.modules.wav2vec2(wavs, wav_lens)
  
      # dimensionality reduction
      src = self.modules.enc(src)
  
      dec_out = self.modules.mBART(
          src, tokens_bos, pad_idx=self.hparams.pad_index
      )
  
      # logits and softmax
      p_seq = self.hparams.log_softmax(dec_out)
      if hparams["mbart_frozen"] and not p_seq.requires_grad:
          p_seq.requires_grad = True
  
      # compute outputs
      hyps = None
      if stage == sb.Stage.VALID and self.optimizer_step >= 1000:
          # the output of the encoder (enc) is used for valid search
          current_epoch = self.hparams.epoch_counter.current
          if current_epoch % self.hparams.valid_search_interval == 0:
              if isinstance(
                  self.modules.mBART, DistributedDataParallel
              ):
                  self.modules.mBART = self.modules.mBART.module
              hyps, _, _, _ = self.hparams.valid_search(
                  src.detach(), wav_lens
              )
  
      elif stage == sb.Stage.TEST:
          if isinstance(self.modules.mBART, DistributedDataParallel):
              self.modules.mBART = self.modules.mBART.module
          hyps, _, _, _ = self.hparams.valid_search(
              src.detach(), wav_lens
          )
  
      return p_seq, wav_lens, hyps
  
file_path: speechbrain/recipes/IWSLT22_lowresource/AST/transformer/train_with_w2v_mbart.py
imports: import sys
  import torch
  import logging
  import speechbrain
  from speechbrain.utils.distributed import run_on_main
  from hyperpyyaml import load_hyperpyyaml
  from sacremoses import MosesDetokenizer
  from torch.nn.parallel import DistributedDataParallel
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