class_docstr: Resource Efficient Separation Pipeline Used for RE-SepFormer and SkiM
  
  Note: This implementation is a generalization of the ESPNET implementation of SkiM
  
  Arguments:
  ----------
  input_size: int,
      Dimension of the input feature.
      Input shape shoud be (batch, length, input_size)
  hidden_size: int,
      Dimension of the hidden state.
  output_size: int,
      Dimension of the output size.
  dropout: float,
      Dropout ratio. Default is 0.
  num_blocks: int
      Number of basic SkiM blocks
  segment_size: int
      Segmentation size for splitting long features
  bidirectional: bool,
      Whether the RNN layers are bidirectional.
  mem_type: 'hc', 'h', 'c', 'id' or None.
      This controls whether the hidden (or cell) state of SegLSTM
      will be processed by MemLSTM.
      In 'id' mode, both the hidden and cell states will
      be identically returned.
      When mem_type is None, the MemLSTM will be removed.
  norm_type: gln, cln.
      cln is for causal implementation.
  seg_model: class
      The model that processes the within segment elements
  mem_model: class
      The memory model that ensures continuity between the segments
  
  Example
  ---------
  >>> x = torch.randn(10, 100, 64)
  >>> seg_mdl = SBTransformerBlock_wnormandskip(1, 64, 8)
  >>> mem_mdl = SBTransformerBlock_wnormandskip(1, 64, 8)
  >>> resepf_pipeline = ResourceEfficientSeparationPipeline(64, 64, 128, seg_model=seg_mdl, mem_model=mem_mdl)
  >>> out = resepf_pipeline.forward(x)
  >>> out.shape
  torch.Size([10, 100, 128])
docstr: The forward function of the ResourceEfficientSeparatioPipeline
  
  This takes in a tensor of size [B, (S*K), D]
  
  Arguments
  ---------
  input : torch.Tensor
          Tensor shape [B, (S*K), D],
          where, B = Batchsize,
                 S = Number of chunks
                 K = Chunksize
                 D = number of features
docstr_tok: ["The","forward","function","of","the","ResourceEfficientSeparatioPipeline","This","takes","in","a","tensor","of","size","[","B",",","(","S","*","K",")",",","D","]","Arguments","--","--","--","--","-","input",":","torch.Tensor","Tensor","shape","[","B",",","(","S","*","K",")",",","D","]",",","where",",","B","=","Batchsize",",","S","=","Number","of","chunks","K","=","Chunksize","D","=","number","of","features"]
code: def forward(self, input):
      """The forward function of the ResourceEfficientSeparatioPipeline
  
      This takes in a tensor of size [B, (S*K), D]
  
      Arguments
      ---------
      input : torch.Tensor
              Tensor shape [B, (S*K), D],
              where, B = Batchsize,
                     S = Number of chunks
                     K = Chunksize
                     D = number of features
      """
      B, T, D = input.shape
  
      input, rest = self._padfeature(input=input)
      input = input.view(B, -1, self.segment_size, D)  # B, S, K, D
      B, S, K, D = input.shape
  
      assert K == self.segment_size
  
      output = input.reshape(B * S, K, D)  # BS, K, D
  
      if self.mem_type == "av":
          hc = torch.zeros(
              output.shape[0], 1, output.shape[-1], device=output.device
          )
      else:
          hc = None
  
      for i in range(self.num_blocks):
          seg_model_type = type(self.seg_model[0]).__name__
          if seg_model_type == "SBTransformerBlock_wnormandskip":
              output = self.seg_model[i](output + hc)  # BS, K, D
          elif seg_model_type == "SegLSTM":
              output, hc = self.seg_model[i](output, hc)  # BS, K, D
          else:
              raise ValueError("Unsupported segment model class")
  
          if i < (self.num_blocks - 1):
              if self.mem_type == "av":
                  hc = output.mean(1).unsqueeze(0)
                  hc = self.mem_model[i](hc).permute(1, 0, 2)
              else:
                  hc = self.mem_model[i](hc, S)
  
      output = output.reshape(B, S * K, D)[:, :T, :]  # B, T, D
      output = self.output_fc(output.transpose(1, 2)).transpose(1, 2)
  
      return output
  
imports: import torch
  import torch.nn
  from speechbrain.lobes.models.dual_path import select_norm
  from speechbrain.lobes.models.transformer.Transformer import TransformerEncoder, PositionalEncoding, get_lookahead_mask
  import speechbrain.nnet.RNN
  import copy
label_desc: Use image node_id 2 for calling the ResourceEfficientSeparationPipeline obj's underlying member method code with example usage: obj.forward(input) and returns: output