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
  
      # compute features
      feats = self.hparams.compute_features(wavs)
      current_epoch = self.hparams.epoch_counter.current
      feats = self.modules.normalize(
          feats, wav_lens, epoch=current_epoch
      )
  
      # Add feature augmentation if specified.
      if stage == sb.Stage.TRAIN and hasattr(
          self.hparams, "fea_augment"
      ):
          feats, fea_lens = self.hparams.fea_augment(feats, wav_lens)
          tokens_bos = self.hparams.fea_augment.replicate_labels(
              tokens_bos
          )
  
      # forward modules
      src = self.modules.CNN(feats)
  
      enc_out, pred = self.modules.Transformer(
          src,
          tokens_bos,
          wav_lens,
          pad_idx=self.hparams.pad_index,
      )
  
      # output layer for ctc log-probabilities
      logits = self.modules.ctc_lin(enc_out)
      p_ctc = self.hparams.log_softmax(logits)
  
      # output layer for seq2seq log-probabilities
      pred = self.modules.seq_lin(pred)
      p_seq = self.hparams.log_softmax(pred)
  
      # Compute outputs
      hyps = None
      current_epoch = self.hparams.epoch_counter.current
      is_valid_search = (
          stage == sb.Stage.VALID
          and current_epoch % self.hparams.valid_search_interval == 0
      )
      is_test_search = stage == sb.Stage.TEST
  
      if any([is_valid_search, is_test_search]):
          # Note: For valid_search, for the sake of efficiency, we only perform beamsearch with
          # limited capacity and no LM to give user some idea of how the AM is doing
  
          # Decide searcher for inference: valid or test search
          if stage == sb.Stage.VALID:
              hyps, _, _, _ = self.hparams.valid_search(
                  enc_out.detach(), wav_lens
              )
          else:
              hyps, _, _, _ = self.hparams.test_search(
                  enc_out.detach(), wav_lens
              )
  
      return p_ctc, p_seq, wav_lens, hyps
  
file_path: speechbrain/recipes/LibriSpeech/ASR/transformer/train.py
imports: import os
  import sys
  import torch
  import logging
  from pathlib import Path
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.distributed import run_on_main, if_main_process
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,  hyps