class_docstr: STFT decoder for speech enhancement and separation
class_docstr_tok: ["STFT","decoder","for","speech","enhancement","and","separation"]
docstr: streaming_merge. It merges the frame-level processed audio chunks
  in the streaming *simulation*. It is noted that, in real applications,
  the processed audio should be sent to the output channel frame by frame.
  You may refer to this function to manage your streaming output buffer.
  
  Args:
      chunks: List [(B, frame_size),]
      ilens: [B]
  Returns:
      merge_audio: [B, T]
docstr_tok: ["streaming_merge",".","It","merges","the","frame-level","processed","audio","chunks","in","the","streaming","*","simulation","*",".","It","is","noted","that",",","in","real","applications",",","the","processed","audio","should","be","sent","to","the","output","channel","frame","by","frame",".","You","may","refer","to","this","function","to","manage","your","streaming","output","buffer",".","Args",":","chunks",":","List","[","(","B",",","frame_size",")",",","]","ilens",":","[","B","]","Returns",":","merge_audio",":","[","B",",","T","]"]
code: def streaming_merge(self, chunks, ilens=None):
      """streaming_merge. It merges the frame-level processed audio chunks
      in the streaming *simulation*. It is noted that, in real applications,
      the processed audio should be sent to the output channel frame by frame.
      You may refer to this function to manage your streaming output buffer.
  
      Args:
          chunks: List [(B, frame_size),]
          ilens: [B]
      Returns:
          merge_audio: [B, T]
      """  # noqa: H405
  
      frame_size = self.win_length
      hop_size = self.hop_length
  
      num_chunks = len(chunks)
      batch_size = chunks[0].shape[0]
      audio_len = int(hop_size * num_chunks + frame_size - hop_size)
  
      output = torch.zeros(
          (batch_size, audio_len), dtype=chunks[0].dtype
      ).to(chunks[0].device)
  
      for i, chunk in enumerate(chunks):
          output[:, i * hop_size : i * hop_size + frame_size] += chunk
  
      window_sq = self._get_window_func().pow(2)
      window_envelop = torch.zeros(
          (batch_size, audio_len), dtype=chunks[0].dtype
      ).to(chunks[0].device)
      for i in range(len(chunks)):
          window_envelop[
              :, i * hop_size : i * hop_size + frame_size
          ] += window_sq
      output = output / window_envelop
  
      # We need to trim the front padding away if center.
      start = (frame_size // 2) if self.center else 0
      end = (
          -(frame_size // 2)
          if ilens.max() is None
          else start + ilens.max()
      )
  
      return output[..., start:end]
  
file_path: espnet/espnet2/enh/decoder/stft_decoder.py
imports: import torch
  import torch_complex
  from packaging.version import parse
  from torch_complex.tensor import ComplexTensor
  from espnet2.enh.decoder.abs_decoder import AbsDecoder
  from espnet2.enh.layers.complex_utils import is_torch_complex_tensor
  from espnet2.layers.stft import Stft
label_desc: Use image node_id 8 for calling the STFTDecoder obj's underlying member method code with example usage: obj.streaming_merge(chunks, ilens) and returns: output