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_with_bos, token_with_bos_lens = batch.tokens_bos
  
      # Add waveform augmentation if specified.
      if stage == sb.Stage.TRAIN:
          if hasattr(self.hparams, "wav_augment"):
              wavs, wav_lens = self.hparams.wav_augment(wavs, wav_lens)
              tokens_with_bos = (
                  self.hparams.wav_augment.replicate_labels(
                      tokens_with_bos
                  )
              )
  
      # Forward pass
      feats = self.hparams.compute_features(wavs)
      feats = self.modules.normalize(feats, wav_lens)
  
      # 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_with_bos = self.hparams.fea_augment.replicate_labels(
              tokens_with_bos
          )
  
      x = self.modules.enc(feats.detach())
      e_in = self.modules.emb(tokens_with_bos)
      h, _ = self.modules.dec(e_in)
      # Joint network
      # add labelseq_dim to the encoder tensor: [B,T,H_enc] => [B,T,1,H_enc]
      # add timeseq_dim to the decoder tensor: [B,U,H_dec] => [B,1,U,H_dec]
      joint = self.modules.Tjoint(x.unsqueeze(2), h.unsqueeze(1))
  
      # Output layer for transducer log-probabilities
      logits_transducer = self.modules.transducer_lin(joint)
  
      # Compute outputs
      if stage == sb.Stage.TRAIN:
          return_CTC = False
          return_CE = False
          current_epoch = self.hparams.epoch_counter.current
          if (
              hasattr(self.hparams, "ctc_cost")
              and current_epoch <= self.hparams.number_of_ctc_epochs
          ):
              return_CTC = True
              # Output layer for ctc log-probabilities
              out_ctc = self.modules.enc_lin(x)
              p_ctc = self.hparams.log_softmax(out_ctc)
          if (
              hasattr(self.hparams, "ce_cost")
              and current_epoch <= self.hparams.number_of_ce_epochs
          ):
              return_CE = True
              # Output layer for ctc log-probabilities
              p_ce = self.modules.dec_lin(h)
              p_ce = self.hparams.log_softmax(p_ce)
          if return_CE and return_CTC:
              return p_ctc, p_ce, logits_transducer, wav_lens
          elif return_CTC:
              return p_ctc, logits_transducer, wav_lens
          elif return_CE:
              return p_ce, logits_transducer, wav_lens
          else:
              return logits_transducer, wav_lens
  
      elif stage == sb.Stage.VALID:
          best_hyps, scores, _, _ = self.hparams.beam_searcher(x)
          return logits_transducer, wav_lens, best_hyps
      else:
          (
              best_hyps,
              best_scores,
              nbest_hyps,
              nbest_scores,
          ) = self.hparams.beam_searcher(x)
          return logits_transducer, wav_lens, best_hyps
  
file_path: speechbrain/recipes/CommonVoice/ASR/transducer/train.py
imports: import sys
  import torch
  import logging
  import speechbrain
  import torchaudio
  from speechbrain.utils.distributed import run_on_main, if_main_process
  from speechbrain.utils.data_utils import undo_padding
  from speechbrain.tokenizers.SentencePiece import SentencePiece
  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_ce,  logits_transducer,  wav_lens, logits_transducer,  wav_lens,  best_hyps, logits_transducer,  wav_lens,  best_hyps, p_ctc,  logits_transducer,  wav_lens, p_ce,  logits_transducer,  wav_lens, logits_transducer,  wav_lens