docstr: The forward pass computes enhanced feats and targets
docstr_tok: ["The","forward","pass","computes","enhanced","feats","and","targets"]
code: def compute_forward(self, batch, stage):
      """The forward pass computes enhanced feats and targets"""
  
      batch = batch.to(self.device)
      self.stage = stage
  
      predictions = {}
      if self.hparams.enhance_type is not None:
          noisy_wavs, lens = self.prepare_wavs(batch.noisy_sig, stage)
  
          # Mask with "signal approximation (SA)"
          if self.hparams.enhance_type == "masking":
              (
                  predictions["wavs"],
                  predictions["feats"],
              ) = self.modules.enhance_model(noisy_wavs)
          elif self.hparams.enhance_type == "noisy":
              predictions["wavs"] = noisy_wavs
          elif self.hparams.enhance_type == "clean":
              predictions["wavs"], _ = self.prepare_wavs(
                  batch.clean_sig
              )
  
      # Generate clean features for ASR pre-training
      if (
          self.hparams.ctc_type == "clean"
          or self.hparams.seq_type == "clean"
      ):
          clean_wavs, lens = self.prepare_wavs(batch.clean_sig, stage)
          clean_feats = self.prepare_feats(clean_wavs)
  
      # Compute seq outputs
      if self.hparams.seq_type is not None:
          # Prepare target inputs
          tokens, token_lens = self.prepare_targets(
              batch.tokens_bos, stage
          )
          tokens = self.modules.tgt_embedding(tokens)
  
          if self.hparams.seq_type == "clean":
              if hasattr(self.hparams, "perceptual_fbank"):
                  clean_feats = self.hparams.fbank(clean_feats)
              embed = self.modules.src_embedding(clean_feats)
          if self.hparams.seq_type == "joint":
              asr_feats = predictions["wavs"]
              asr_feats = self.hparams.fbank(asr_feats)
              asr_feats = self.hparams.normalizer(asr_feats, lens)
              embed = self.modules.src_embedding(asr_feats)
          dec_out = self.modules.recognizer(tokens, embed, lens)
          out = self.modules.seq_output(dec_out[0])
          predictions["seq_pout"] = torch.log_softmax(out, dim=-1)
  
          if self.hparams.ctc_type is not None:
              out = self.modules.ctc_output(embed)
              predictions["ctc_pout"] = torch.log_softmax(out, dim=-1)
  
          if stage != sb.Stage.TRAIN:
              hyps, _, _, _ = self.hparams.beam_searcher(
                  embed.detach(), lens
              )
  
              # Convert best hypothesis to list
              predictions["hyps"] = hyps
  
      elif self.hparams.ctc_type is not None:
          if self.hparams.ctc_type == "clean":
              embed = self.modules.src_embedding(clean_feats)
          elif self.hparams.ctc_type == "joint":
              enh_feats = self.hparams.spectral_magnitude(
                  predictions["feats"]
              )
              enh_feats = torch.log1p(enh_feats)
              embed = self.modules.src_embedding(enh_feats)
          out = self.modules.ctc_output(embed)
          predictions["ctc_pout"] = torch.log_softmax(out, dim=-1)
  
      return predictions
  
imports: import os
  import sys
  import torch
  import torchaudio
  import logging
  import speechbrain
  from pesq import pesq
  from pystoi import stoi
  from composite_eval import eval_composite
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.data_utils import undo_padding
  from speechbrain.utils.distributed import run_on_main, if_main_process
label_desc: Use image node_id 1 for calling the MTLbrain obj's underlying member method code with example usage: obj.compute_forward(batch, stage) and returns: predictions