class_docstr: A Short-time Fourier transform layer.
  
  It uses `tf.signal.stft` to compute complex STFT. Additionally, it reshapes the output to be a proper 2D batch.
  
  If `output_data_format == 'channels_last'`, the output shape is (batch, time, freq, channel)
  If `output_data_format == 'channels_first'`, the output shape is (batch, channel, time, freq)
  
  Args:
      n_fft (int): Number of FFTs. Defaults to `2048`
      win_length (int or None): Window length in sample. Defaults to `n_fft`.
      hop_length (int or None): Hop length in sample between analysis windows. Defaults to `win_length // 4` following Librosa.
      window_name (str or None): *Name* of `tf.signal` function that returns a 1D tensor window that is used in analysis.
          Defaults to `hann_window` which uses `tf.signal.hann_window`.
          Window availability depends on Tensorflow version. More details are at `kapre.backend.get_window()`.
      pad_begin (bool): Whether to pad with zeros along time axis (length: win_length - hop_length). Defaults to `False`.
      pad_end (bool): Whether to pad with zeros at the finishing end of the signal.
      input_data_format (str): the audio data format of input waveform batch.
          `'channels_last'` if it's `(batch, time, channels)` and
          `'channels_first'` if it's `(batch, channels, time)`.
          Defaults to the setting of your Keras configuration. (`tf.keras.backend.image_data_format()`)
      output_data_format (str): The data format of output STFT.
          `'channels_last'` if you want `(batch, time, frequency, channels)` and
          `'channels_first'` if you want `(batch, channels, time, frequency)`
          Defaults to the setting of your Keras configuration. (`tf.keras.backend.image_data_format()`)
  
      **kwargs: Keyword args for the parent keras layer (e.g., `name`)
  
  Example:
      ::
  
          input_shape = (2048, 1)  # mono signal
          model = Sequential()
          model.add(kapre.STFT(n_fft=1024, hop_length=512, input_shape=input_shape))
          # now the shape is (batch, n_frame=3, n_freq=513, ch=1)
          # and the dtype is complex
class_docstr_tok: ["A","Short-time","Fourier","transform","layer",".","It","uses","`","tf.signal.stft","`","to","compute","complex","STFT",".","Additionally",",","it","reshapes","the","output","to","be","a","proper","2D","batch",".","If","`","output_data_format","==","'channels_last","'","`",",","the","output","shape","is","(","batch",",","time",",","freq",",","channel",")","If","`","output_data_format","==","'channels_first","'","`",",","the","output","shape","is","(","batch",",","channel",",","time",",","freq",")","Args",":","n_fft","(","int",")",":","Number","of","FFTs",".","Defaults","to","`","2048","`","win_length","(","int","or","None",")",":","Window","length","in","sample",".","Defaults","to","`","n_fft","`",".","hop_length","(","int","or","None",")",":","Hop","length","in","sample","between","analysis","windows",".","Defaults","to","`","win_length","\/\/","4","`","following","Librosa",".","window_name","(","str","or","None",")",":","*","Name","*","of","`","tf.signal","`","function","that","returns","a","1D","tensor","window","that","is","used","in","analysis",".","Defaults","to","`","hann_window","`","which","uses","`","tf.signal.hann_window","`",".","Window","availability","depends","on","Tensorflow","version",".","More","details","are","at","`","kapre.backend.get_window","(",")","`",".","pad_begin","(","bool",")",":","Whether","to","pad","with","zeros","along","time","axis","(","length",":","win_length","-","hop_length",")",".","Defaults","to","`","False","`",".","pad_end","(","bool",")",":","Whether","to","pad","with","zeros","at","the","finishing","end","of","the","signal",".","input_data_format","(","str",")",":","the","audio","data","format","of","input","waveform","batch",".","`","'channels_last","'","`","if","it","'s","`","(","batch",",","time",",","channels",")","`","and","`","'channels_first","'","`","if","it","'s","`","(","batch",",","channels",",","time",")","`",".","Defaults","to","the","setting","of","your","Keras","configuration",".","(","`","tf.keras.backend.image_data_format","(",")","`",")","output_data_format","(","str",")",":","The","data","format","of","output","STFT",".","`","'channels_last","'","`","if","you","want","`","(","batch",",","time",",","frequency",",","channels",")","`","and","`","'channels_first","'","`","if","you","want","`","(","batch",",","channels",",","time",",","frequency",")","`","Defaults","to","the","setting","of","your","Keras","configuration",".","(","`","tf.keras.backend.image_data_format","(",")","`",")","*","*","kwargs",":","Keyword","args","for","the","parent","keras","layer","(","e.g.",",","`","name","`",")","Example",":",":",":","input_shape","=","(","2048",",","1",")","#","mono","signal","model","=","Sequential","(",")","model.add","(","kapre.STFT","(","n_fft=1024",",","hop_length=512",",","input_shape=input_shape",")",")","#","now","the","shape","is","(","batch",",","n_frame=3",",","n_freq=513",",","ch=1",")","#","and","the","dtype","is","complex"]
docstr: Compute STFT of the input signal. If the `time` axis is not the last axis of `x`, it should be transposed first.
  
  Args:
      x (float `Tensor`): batch of audio signals, (batch, ch, time) or (batch, time, ch) based on input_data_format
  
  Return:
      (complex `Tensor`): A STFT representation of x in a 2D batch shape.
      `complex64` if `x` is `float32`, `complex128` if `x` is `float64`.
      Its shape is (batch, time, freq, ch) or (batch. ch, time, freq) depending on `output_data_format` and
      `time` is the number of frames, which is `((len_src + (win_length - hop_length) / hop_length) // win_length )` if `pad_end` is `True`.
      `freq` is the number of fft unique bins, which is `n_fft // 2 + 1` (the unique components of the FFT).
docstr_tok: ["Compute","STFT","of","the","input","signal",".","If","the","`","time","`","axis","is","not","the","last","axis","of","`","x","`",",","it","should","be","transposed","first",".","Args",":","x","(","float","`","Tensor","`",")",":","batch","of","audio","signals",",","(","batch",",","ch",",","time",")","or","(","batch",",","time",",","ch",")","based","on","input_data_format","Return",":","(","complex","`","Tensor","`",")",":","A","STFT","representation","of","x","in","a","2D","batch","shape",".","`","complex64","`","if","`","x","`","is","`","float32","`",",","`","complex128","`","if","`","x","`","is","`","float64","`",".","Its","shape","is","(","batch",",","time",",","freq",",","ch",")","or","(","batch",".","ch",",","time",",","freq",")","depending","on","`","output_data_format","`","and","`","time","`","is","the","number","of","frames",",","which","is","`","(","(","len_src","+","(","win_length","-","hop_length",")","\/","hop_length",")","\/\/","win_length",")","`","if","`","pad_end","`","is","`","True","`",".","`","freq","`","is","the","number","of","fft","unique","bins",",","which","is","`","n_fft","\/\/","2","+","1","`","(","the","unique","components","of","the","FFT",")","."]
code: def call(self, x):
      """
      Compute STFT of the input signal. If the `time` axis is not the last axis of `x`, it should be transposed first.
  
      Args:
          x (float `Tensor`): batch of audio signals, (batch, ch, time) or (batch, time, ch) based on input_data_format
  
      Return:
          (complex `Tensor`): A STFT representation of x in a 2D batch shape.
          `complex64` if `x` is `float32`, `complex128` if `x` is `float64`.
          Its shape is (batch, time, freq, ch) or (batch. ch, time, freq) depending on `output_data_format` and
          `time` is the number of frames, which is `((len_src + (win_length - hop_length) / hop_length) // win_length )` if `pad_end` is `True`.
          `freq` is the number of fft unique bins, which is `n_fft // 2 + 1` (the unique components of the FFT).
      """
      waveforms = x  # (batch, ch, time) if input_data_format == 'channels_first'.
      # (batch, time, ch) if input_data_format == 'channels_last'.
  
      # this is needed because tf.signal.stft lives in channels_first land.
      if self.input_data_format == _CH_LAST_STR:
          waveforms = tf.transpose(
              waveforms, perm=(0, 2, 1)
          )  # always (batch, ch, time) from here
  
      if self.pad_begin:
          waveforms = tf.pad(
              waveforms,
              tf.constant(
                  [
                      [0, 0],
                      [0, 0],
                      [int(self.n_fft - self.hop_length), 0],
                  ]
              ),
          )
  
      stfts = tf.signal.stft(
          signals=waveforms,
          frame_length=self.win_length,
          frame_step=self.hop_length,
          fft_length=self.n_fft,
          window_fn=self.window_fn,
          pad_end=self.pad_end,
          name="%s_tf.signal.stft" % self.name,
      )  # (batch, ch, time, freq)
  
      if self.output_data_format == _CH_LAST_STR:
          stfts = tf.transpose(
              stfts, perm=(0, 2, 3, 1)
          )  # (batch, t, f, ch)
  
      return stfts
  
imports: import tensorflow
  from tensorflow.keras import backend
  from tensorflow.keras.layers import Layer
  from .None import backend
  from .backend import _CH_FIRST_STR, _CH_LAST_STR, _CH_DEFAULT_STR
  from .tflite_compatible_stft import atan2_tflite
label_desc: Use image node_id 2 for calling the STFT obj's underlying member method code with example usage: obj.call(x) and returns: stfts