class_docstr: Skipping Memory Net
  
  args:
      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: number of basic SkiM blocks
      segment_size: segmentation size for splitting long features
      bidirectional: bool, whether the RNN layers are bidirectional.
      mem_type: 'hc', 'h', 'c', 'id' or None.
          It 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_overlap: Bool, whether the segmentation will reserve 50%
          overlap for adjacent segments.Default is False.
class_docstr_tok: ["Skipping","Memory","Net","args",":","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",":","number","of","basic","SkiM","blocks","segment_size",":","segmentation","size","for","splitting","long","features","bidirectional",":","bool",",","whether","the","RNN","layers","are","bidirectional",".","mem_type",":","'hc","'",",","'","h","'",",","'","c","'",",","'id","'","or","None",".","It","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_overlap",":","Bool",",","whether","the","segmentation","will","reserve","50","%","overlap","for","adjacent","segments.Default","is","False","."]
code: def forward_stream(self, input_frame, states):
      # input_frame # B, 1, N
  
      B, _, N = input_frame.shape
  
      def empty_seg_states():
          shp = (1, B, self.hidden_size)
          return (
              torch.zeros(
                  *shp,
                  device=input_frame.device,
                  dtype=input_frame.dtype,
              ),
              torch.zeros(
                  *shp,
                  device=input_frame.device,
                  dtype=input_frame.dtype,
              ),
          )
  
      B, _, N = input_frame.shape
      if not states:
          states = {
              "current_step": 0,
              "seg_state": [
                  empty_seg_states() for i in range(self.num_blocks)
              ],
              "mem_state": [
                  [None, None] for i in range(self.num_blocks - 1)
              ],
          }
  
      output = input_frame
  
      if (
          states["current_step"]
          and (states["current_step"]) % self.segment_size == 0
      ):
          tmp_states = [
              empty_seg_states() for i in range(self.num_blocks)
          ]
          for i in range(self.num_blocks - 1):
              (
                  tmp_states[i + 1],
                  states["mem_state"][i],
              ) = self.mem_lstms[i].forward_one_step(
                  states["seg_state"][i], states["mem_state"][i]
              )
  
          states["seg_state"] = tmp_states
  
      for i in range(self.num_blocks):
          output, states["seg_state"][i] = self.seg_lstms[i](
              output, states["seg_state"][i]
          )
  
      states["current_step"] += 1
  
      output = self.output_fc(output.transpose(1, 2)).transpose(1, 2)
  
      return output, states
  
file_path: espnet/espnet2/enh/layers/skim.py
imports: import torch
  import torch.nn
  from espnet2.enh.layers.dprnn import SingleRNN, merge_feature, split_feature
  from espnet2.enh.layers.tcn import choose_norm
label_desc: Use image node_id 4 for calling the SkiM obj's underlying member method code with example usage: obj.forward_stream(input_frame, states) and returns: output,  states, torch,  torch