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
      tokens_bos, _ = batch.tokens_bos
      wavs, wav_lens = wavs.to(self.device), wav_lens.to(self.device)
  
      # Add waveform augmentation if specified.
      if stage == sb.Stage.TRAIN and hasattr(
          self.hparams, "wav_augment"
      ):
          wavs, wav_lens = self.hparams.wav_augment(wavs, wav_lens)
          tokens_bos = self.hparams.wav_augment.replicate_labels(
              tokens_bos
          )
  
      # Forward pass
      feats = self.hparams.compute_features(wavs)
  
      if stage == sb.Stage.TRAIN and hasattr(
          self.hparams, "fea_augment"
      ):
          feats, fea_lens = self.hparams.fea_augment(feats, wav_lens)
  
      feats = self.modules.normalize(feats, wav_lens)
      x = self.modules.enc(feats.detach())
      e_in = self.modules.emb(tokens_bos)  # y_in bos + tokens
      h, _ = self.modules.dec(e_in, x, wav_lens)
  
      # Output layer for seq2seq log-probabilities
      logits = self.modules.seq_lin(h)
      p_seq = self.hparams.log_softmax(logits)
  
      # Compute outputs
      p_ctc, p_tokens = None, None
      if stage == sb.Stage.TRAIN:
          current_epoch = self.hparams.epoch_counter.current
          if current_epoch <= self.hparams.number_of_ctc_epochs:
              # Output layer for ctc log-probabilities
              logits = self.modules.ctc_lin(x)
              p_ctc = self.hparams.log_softmax(logits)
      else:
          p_tokens, _, _, _ = self.hparams.beam_search(x, wav_lens)
  
      return p_ctc, p_seq, wav_lens, p_tokens
  
file_path: speechbrain/recipes/AISHELL-1/ASR/seq2seq/train.py
imports: import sys
  import torch
  import logging
  import speechbrain
  from speechbrain.utils.distributed import run_on_main
  from hyperpyyaml import load_hyperpyyaml
label_desc: Use image node_id 1 for calling the ASR obj's underlying member method code with example usage: obj.compute_forward(batch, stage) and returns: p_ctc,  p_seq,  wav_lens,  p_tokens