class_docstr: This function is to calculate the short-time Fourier transform (STFT) of the input signal.
  Input signal should be in either of the following shapes.
  
  1. ``(len_audio)``
  
  2. ``(num_audio, len_audio)``
  
  3. ``(num_audio, 1, len_audio)``
  
  The correct shape will be inferred automatically if the input follows these 3 shapes.
  Most of the arguments follow the convention from librosa.
  This class inherits from ``nn.Module``, therefore, the usage is same as ``nn.Module``.
  
  Parameters
  ----------
  n_fft : int
      Size of Fourier transform. Default value is 2048.
  
  win_length : int
      the size of window frame and STFT filter.
      Default: None (treated as equal to n_fft)
  
  freq_bins : int
      Number of frequency bins. Default is ``None``, which means ``n_fft//2+1`` bins.
  
  hop_length : int
      The hop (or stride) size. Default value is ``None`` which is equivalent to ``n_fft//4``.
  
  window : str
      The windowing function for STFT. It uses ``scipy.signal.get_window``, please refer to
      scipy documentation for possible windowing functions. The default value is 'hann'.
  
  freq_scale : 'linear', 'log', 'log2' or 'no'
      Determine the spacing between each frequency bin. When `linear`, 'log' or `log2` is used,
      the bin spacing can be controlled by ``fmin`` and ``fmax``. If 'no' is used, the bin will
      start at 0Hz and end at Nyquist frequency with linear spacing.
  
  center : bool
      Putting the STFT keneral at the center of the time-step or not. If ``False``, the time
      index is the beginning of the STFT kernel, if ``True``, the time index is the center of
      the STFT kernel. Default value if ``True``.
  
  pad_mode : str
      The padding method. Default value is 'reflect'.
  
  iSTFT : bool
      To activate the iSTFT module or not. By default, it is False to save GPU memory.
      Note: The iSTFT kernel is not trainable. If you want
      a trainable iSTFT, use the iSTFT module.
  
  fmin : int
      The starting frequency for the lowest frequency bin. If freq_scale is ``no``, this argument
      does nothing.
  
  fmax : int
      The ending frequency for the highest frequency bin. If freq_scale is ``no``, this argument
      does nothing.
  
  sr : int
      The sampling rate for the input audio. It is used to calucate the correct ``fmin`` and ``fmax``.
      Setting the correct sampling rate is very important for calculating the correct frequency.
  
  trainable : bool
      Determine if the STFT kenrels are trainable or not. If ``True``, the gradients for STFT
      kernels will also be caluclated and the STFT kernels will be updated during model training.
      Default value is ``False``
  
  output_format : str
      Control the spectrogram output type, either ``Magnitude``, ``Complex``, or ``Phase``.
      The output_format can also be changed during the ``forward`` method.
  
  verbose : bool
      If ``True``, it shows layer information. If ``False``, it suppresses all prints
  
  Returns
  -------
  spectrogram : torch.tensor
      It returns a tensor of spectrograms.
      ``shape = (num_samples, freq_bins,time_steps)`` if ``output_format='Magnitude'``;
      ``shape = (num_samples, freq_bins,time_steps, 2)`` if ``output_format='Complex' or 'Phase'``;
  
  Examples
  --------
  >>> spec_layer = Spectrogram.STFT()
  >>> specs = spec_layer(x)
class_docstr_tok: ["This","function","is","to","calculate","the","short-time","Fourier","transform","(","STFT",")","of","the","input","signal",".","Input","signal","should","be","in","either","of","the","following","shapes",".","1",".","``","(","len_audio",")","``","2",".","``","(","num_audio",",","len_audio",")","``","3",".","``","(","num_audio",",","1",",","len_audio",")","``","The","correct","shape","will","be","inferred","automatically","if","the","input","follows","these","3","shapes",".","Most","of","the","arguments","follow","the","convention","from","librosa",".","This","class","inherits","from","``","nn.Module","``",",","therefore",",","the","usage","is","same","as","``","nn.Module","``",".","Parameters","--","--","--","--","--","n_fft",":","int","Size","of","Fourier","transform",".","Default","value","is","2048.","win_length",":","int","the","size","of","window","frame","and","STFT","filter",".","Default",":","None","(","treated","as","equal","to","n_fft",")","freq_bins",":","int","Number","of","frequency","bins",".","Default","is","``","None","``",",","which","means","``","n_fft\/\/2+1","``","bins",".","hop_length",":","int","The","hop","(","or","stride",")","size",".","Default","value","is","``","None","``","which","is","equivalent","to","``","n_fft\/\/4","``",".","window",":","str","The","windowing","function","for","STFT",".","It","uses","``","scipy.signal.get_window","``",",","please","refer","to","scipy","documentation","for","possible","windowing","functions",".","The","default","value","is","'hann","'",".","freq_scale",":","'linear","'",",","'log","'",",","'log2","'","or","'no'","Determine","the","spacing","between","each","frequency","bin",".","When","`","linear","`",",","'log","'","or","`","log2","`","is","used",",","the","bin","spacing","can","be","controlled","by","``","fmin","``","and","``","fmax","``",".","If","'no","'","is","used",",","the","bin","will","start","at","0Hz","and","end","at","Nyquist","frequency","with","linear","spacing",".","center",":","bool","Putting","the","STFT","keneral","at","the","center","of","the","time-step","or","not",".","If","``","False","``",",","the","time","index","is","the","beginning","of","the","STFT","kernel",",","if","``","True","``",",","the","time","index","is","the","center","of","the","STFT","kernel",".","Default","value","if","``","True","``",".","pad_mode",":","str","The","padding","method",".","Default","value","is","'reflect","'",".","iSTFT",":","bool","To","activate","the","iSTFT","module","or","not",".","By","default",",","it","is","False","to","save","GPU","memory",".","Note",":","The","iSTFT","kernel","is","not","trainable",".","If","you","want","a","trainable","iSTFT",",","use","the","iSTFT","module",".","fmin",":","int","The","starting","frequency","for","the","lowest","frequency","bin",".","If","freq_scale","is","``","no","``",",","this","argument","does","nothing",".","fmax",":","int","The","ending","frequency","for","the","highest","frequency","bin",".","If","freq_scale","is","``","no","``",",","this","argument","does","nothing",".","sr",":","int","The","sampling","rate","for","the","input","audio",".","It","is","used","to","calucate","the","correct","``","fmin","``","and","``","fmax","``",".","Setting","the","correct","sampling","rate","is","very","important","for","calculating","the","correct","frequency",".","trainable",":","bool","Determine","if","the","STFT","kenrels","are","trainable","or","not",".","If","``","True","``",",","the","gradients","for","STFT","kernels","will","also","be","caluclated","and","the","STFT","kernels","will","be","updated","during","model","training",".","Default","value","is","``","False","``","output_format",":","str","Control","the","spectrogram","output","type",",","either","``","Magnitude","``",",","``","Complex","``",",","or","``","Phase","``",".","The","output_format","can","also","be","changed","during","the","``","forward","``","method",".","verbose",":","bool","If","``","True","``",",","it","shows","layer","information",".","If","``","False","``",",","it","suppresses","all","prints","Returns","--","--","--","-","spectrogram",":","torch.tensor","It","returns","a","tensor","of","spectrograms",".","``","shape","=","(","num_samples",",","freq_bins",",","time_steps",")","``","if","``","output_format='Magnitude","'","``",";","``","shape","=","(","num_samples",",","freq_bins",",","time_steps",",","2",")","``","if","``","output_format='Complex","'","or","'Phase","'","``",";","Examples","--","--","--","--",">",">",">","spec_layer","=","Spectrogram.STFT","(",")",">",">",">","specs","=","spec_layer","(","x",")"]
docstr: This function is same as the :func:`~nnAudio.Spectrogram.iSTFT` class,
  which is to convert spectrograms back to waveforms.
  It only works for the complex value spectrograms. If you have the magnitude spectrograms,
  please use :func:`~nnAudio.Spectrogram.Griffin_Lim`.
  
  Parameters
  ----------
  onesided : bool
      If your spectrograms only have ``n_fft//2+1`` frequency bins, please use ``onesided=True``,
      else use ``onesided=False``
  
  length : int
      To make sure the inverse STFT has the same output length of the original waveform, please
      set `length` as your intended waveform length. By default, ``length=None``,
      which will remove ``n_fft//2`` samples from the start and the end of the output.
  
  refresh_win : bool
      Recalculating the window sum square. If you have an input with fixed number of timesteps,
      you can increase the speed by setting ``refresh_win=False``. Else please keep ``refresh_win=True``
docstr_tok: ["This","function","is","same","as","the",":","func",":","`","~nnAudio.Spectrogram.iSTFT","`","class",",","which","is","to","convert","spectrograms","back","to","waveforms",".","It","only","works","for","the","complex","value","spectrograms",".","If","you","have","the","magnitude","spectrograms",",","please","use",":","func",":","`","~nnAudio.Spectrogram.Griffin_Lim","`",".","Parameters","--","--","--","--","--","onesided",":","bool","If","your","spectrograms","only","have","``","n_fft\/\/2+1","``","frequency","bins",",","please","use","``","onesided=True","``",",","else","use","``","onesided=False","``","length",":","int","To","make","sure","the","inverse","STFT","has","the","same","output","length","of","the","original","waveform",",","please","set","`","length","`","as","your","intended","waveform","length",".","By","default",",","``","length=None","``",",","which","will","remove","``","n_fft\/\/2","``","samples","from","the","start","and","the","end","of","the","output",".","refresh_win",":","bool","Recalculating","the","window","sum","square",".","If","you","have","an","input","with","fixed","number","of","timesteps",",","you","can","increase","the","speed","by","setting","``","refresh_win=False","``",".","Else","please","keep","``","refresh_win=True","``"]
code: def inverse(self, X, onesided=True, length=None, refresh_win=True):
      """
      This function is same as the :func:`~nnAudio.Spectrogram.iSTFT` class,
      which is to convert spectrograms back to waveforms.
      It only works for the complex value spectrograms. If you have the magnitude spectrograms,
      please use :func:`~nnAudio.Spectrogram.Griffin_Lim`.
  
      Parameters
      ----------
      onesided : bool
          If your spectrograms only have ``n_fft//2+1`` frequency bins, please use ``onesided=True``,
          else use ``onesided=False``
  
      length : int
          To make sure the inverse STFT has the same output length of the original waveform, please
          set `length` as your intended waveform length. By default, ``length=None``,
          which will remove ``n_fft//2`` samples from the start and the end of the output.
  
      refresh_win : bool
          Recalculating the window sum square. If you have an input with fixed number of timesteps,
          you can increase the speed by setting ``refresh_win=False``. Else please keep ``refresh_win=True``
  
  
      """
      if (hasattr(self, "kernel_sin_inv") != True) or (
          hasattr(self, "kernel_cos_inv") != True
      ):
          raise NameError(
              "Please activate the iSTFT module by setting `iSTFT=True` if you want to use `inverse`"
          )
  
      assert X.dim() == 4, (
          "Inverse iSTFT only works for complex number,"
          "make sure our tensor is in the shape of (batch, freq_bins, timesteps, 2)."
          "\nIf you have a magnitude spectrogram, please consider using Griffin-Lim."
      )
      return self.inverse_stft(
          X,
          self.kernel_cos_inv,
          self.kernel_sin_inv,
          onesided,
          length,
          refresh_win,
      )
  
file_path: nnAudio/Installation/nnAudio/features/stft.py
imports: from torch.nn.functional import conv1d, conv2d, fold
  import torch.nn
  import torch
  import numpy
  from time import time
  from ..utils import *
  from scipy.signal import get_window
label_desc: Use image node_id 3 for calling the STFT obj's underlying member method code with example usage: obj.inverse(X, onesided, length, refresh_win) and returns: self