code: def overlap_and_add(signal, frame_step):
      """Taken from https://github.com/kaituoxu/Conv-TasNet/blob/master/src/utils.py
  
      Reconstructs a signal from a framed representation.
      Adds potentially overlapping frames of a signal with shape
      `[..., frames, frame_length]`, offsetting subsequent frames by `frame_step`.
      The resulting tensor has shape `[..., output_size]` where
          output_size = (frames - 1) * frame_step + frame_length
      Args:
          signal: A [..., frames, frame_length] Tensor. All dimensions may be unknown, and rank must be at least 2.
          frame_step: An integer denoting overlap offsets. Must be less than or equal to frame_length.
      Returns:
          A Tensor with shape [..., output_size] containing the overlap-added frames of signal's inner-most two dimensions.
          output_size = (frames - 1) * frame_step + frame_length
      Based on https://github.com/tensorflow/tensorflow/blob/r1.12/tensorflow/contrib/signal/python/ops/reconstruction_ops.py
  
      Example
      -------
      >>> signal = torch.randn(5, 20)
      >>> overlapped = overlap_and_add(signal, 20)
      >>> overlapped.shape
      torch.Size([100])
      """
      outer_dimensions = signal.size()[:-2]
      frames, frame_length = signal.size()[-2:]
  
      subframe_length = math.gcd(
          frame_length, frame_step
      )  # gcd=Greatest Common Divisor
      subframe_step = frame_step // subframe_length
      subframes_per_frame = frame_length // subframe_length
      output_size = frame_step * (frames - 1) + frame_length
      output_subframes = output_size // subframe_length
  
      subframe_signal = signal.view(
          *outer_dimensions, -1, subframe_length
      )
  
      frame = torch.arange(0, output_subframes).unfold(
          0, subframes_per_frame, subframe_step
      )
  
      # frame_old = signal.new_tensor(frame).long()  # signal may in GPU or CPU
      frame = frame.clone().detach().to(signal.device.type)
      # print((frame - frame_old).sum())
      frame = frame.contiguous().view(-1)
  
      result = signal.new_zeros(
          *outer_dimensions, output_subframes, subframe_length
      )
      result.index_add_(-2, frame, subframe_signal)
      result = result.view(*outer_dimensions, -1)
      return result
  
file_path: speechbrain/speechbrain/processing/signal_processing.py
imports: import torch
  import math
  from packaging import version
label_desc: Use image node_id 9 for calling a global function with example usage: overlap_and_add(signal, frame_step) and returns: result