class_docstr: A "ready-to-use" speech separation model.
  
  Uses Sepformer architecture.
  
  Example
  -------
  >>> tmpdir = getfixture("tmpdir")
  >>> model = SepformerSeparation.from_hparams(
  ...     source="speechbrain/sepformer-wsj02mix",
  ...     savedir=tmpdir)
  >>> mix = torch.randn(1, 400)
  >>> est_sources = model.separate_batch(mix)
  >>> print(est_sources.shape)
  torch.Size([1, 400, 2])
class_docstr_tok: ["A","``","ready-to-use","''","speech","separation","model",".","Uses","Sepformer","architecture",".","Example","--","--","--","-",">",">",">","tmpdir","=","getfixture","(","``","tmpdir","''",")",">",">",">","model","=","SepformerSeparation.from_hparams","(","...","source=","''","speechbrain\/sepformer-wsj02mix","''",",","...","savedir=tmpdir",")",">",">",">","mix","=","torch.randn","(","1",",","400",")",">",">",">","est_sources","=","model.separate_batch","(","mix",")",">",">",">","print","(","est_sources.shape",")","torch.Size","(","[","1",",","400",",","2","]",")"]
docstr: Run source separation on batch of audio.
  
  Arguments
  ---------
  mix : torch.Tensor
      The mixture of sources.
  
  Returns
  -------
  tensor
      Separated sources
docstr_tok: ["Run","source","separation","on","batch","of","audio",".","Arguments","--","--","--","--","-","mix",":","torch.Tensor","The","mixture","of","sources",".","Returns","--","--","--","-","tensor","Separated","sources"]
code: def separate_batch(self, mix):
      """Run source separation on batch of audio.
  
      Arguments
      ---------
      mix : torch.Tensor
          The mixture of sources.
  
      Returns
      -------
      tensor
          Separated sources
      """
  
      # Separation
      mix = mix.to(self.device)
      mix_w = self.mods.encoder(mix)
      est_mask = self.mods.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.mods.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
  
file_path: speechbrain/speechbrain/inference/separation.py
imports: import torch
  import torchaudio
  import torch.nn.functional
  from speechbrain.utils.fetching import fetch
  from speechbrain.utils.data_utils import split_path
  from speechbrain.inference.interfaces import Pretrained
label_desc: Use image node_id 1 for calling the SepformerSeparation obj's underlying member method code with example usage: obj.separate_batch(mix) and returns: est_source