docstr: Forward computations from the mixture to the separated signals.
docstr_tok: ["Forward","computations","from","the","mixture","to","the","separated","signals","."]
code: def compute_forward(self, mix, targets, stage, noise=None):
      """Forward computations from the mixture to the separated signals."""
  
      # Unpack lists and put tensors in the right device
      mix, mix_lens = mix
      mix, mix_lens = mix.to(self.device), mix_lens.to(self.device)
  
      # Convert targets to tensor
      targets = torch.cat(
          [
              targets[i][0].unsqueeze(-1)
              for i in range(self.hparams.num_spks)
          ],
          dim=-1,
      ).to(self.device)
  
      # Add speech distortions
      if stage == sb.Stage.TRAIN:
          with torch.no_grad():
              if self.hparams.use_speedperturb:
                  mix, targets = self.add_speed_perturb(
                      targets, mix_lens
                  )
  
                  mix = targets.sum(-1)
  
              if self.hparams.use_wavedrop:
                  mix = self.hparams.drop_chunk(mix, mix_lens)
                  mix = self.hparams.drop_freq(mix)
  
              if self.hparams.limit_training_signal_len:
                  mix, targets = self.cut_signals(mix, targets)
  
      # Separation
      mix_w = self.hparams.Encoder(mix)
      est_mask = self.hparams.MaskNet(mix_w)
      mix_w = torch.stack([mix_w] * self.hparams.num_spks)
      sep_h = mix_w * est_mask
  
      # Decoding
      est_source = torch.cat(
          [
              self.hparams.Decoder(sep_h[i]).unsqueeze(-1)
              for i in range(self.hparams.num_spks)
          ],
          dim=-1,
      )
  
      # T changed after conv1d in encoder, fix it here
      T_origin = mix.size(1)
      T_est = est_source.size(1)
      if T_origin > T_est:
          est_source = F.pad(est_source, (0, 0, 0, T_origin - T_est))
      else:
          est_source = est_source[:, :T_origin, :]
  
      return est_source, targets
  
imports: import os
  import sys
  import torch
  import torch.nn.functional
  import torchaudio
  import speechbrain
  import speechbrain.nnet.schedulers
  from speechbrain.utils.distributed import run_on_main
  from hyperpyyaml import load_hyperpyyaml
  import numpy
  from tqdm import tqdm
  import csv
  import logging
  from speechbrain.core import AMPConfig
label_desc: Use image node_id 1 for calling the Separation obj's underlying member method code with example usage: obj.compute_forward(mix, targets, stage, noise) and returns: est_source,  targets