docstr: Given an input batch it computes the phoneme probabilities.
docstr_tok: ["Given","an","input","batch","it","computes","the","phoneme","probabilities","."]
code: def compute_forward(self, batch, stage):
      "Given an input batch it computes the phoneme probabilities."
      batch = batch.to(self.device)
      wavs, wav_lens = batch.sig
      phns, phn_lens = batch.phn_encoded
  
      # 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)
          phns = self.hparams.wav_augment.replicate_labels(phns)
  
      # Model computations
      feats = self.hparams.compute_features(wavs)
      feats = self.modules.normalize(feats, wav_lens)
      x = self.modules.enc(feats)
      x = self.modules.enc_lin(x)
  
      # Prepend bos token at the beginning
      y_in = sb.dataio.dataio.prepend_bos_token(
          phns, self.hparams.blank_index
      )
      e_in = self.modules.emb(y_in)
      h, _ = self.modules.dec(e_in)
      h = self.modules.dec_lin(h)
  
      # 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 seq2seq log-probabilities
      logits = self.modules.output(joint)
  
      if stage == sb.Stage.VALID:
          hyps, _, _, _ = self.hparams.Greedysearcher(x)
          return logits, wav_lens, hyps
  
      elif stage == sb.Stage.TEST:
          (
              best_hyps,
              best_scores,
              nbest_hyps,
              nbest_scores,
          ) = self.hparams.Beamsearcher(x)
          return logits, wav_lens, best_hyps
      return logits, wav_lens
  
file_path: speechbrain/recipes/TIMIT/ASR/transducer/train.py
imports: import os
  import sys
  import logging
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 1 for calling the ASR_Brain obj's underlying member method code with example usage: obj.compute_forward(batch, stage) and returns: logits,  wav_lens, logits,  wav_lens,  hyps, logits,  wav_lens,  best_hyps