code: def _stft_v1(
      x,
      window_size,
      stride,
      fft_size,
      window_type="hanning",
      center=True,
      pad_mode="reflect",
  ):
      """Computes the short-time Fourier transform
  
      Args:
          x (~nnabla.Variable): Time domain sequence of size `batch_size x sample_size`.
          window_size (int): Size of STFT analysis window.
          stride (int): Number of samples that we shift the window, also called `hop size`.
          fft_size (int): Size of the FFT, the output will have `fft_size // 2+ 1` frequency bins.
          window_type (str): Analysis window, can be either `hanning`, `hamming` or `rectangular`.
              For convenience, also `window_type=None` is supported which is equivalent to `window_type='rectangular'`.
          center (bool): If `True`, then the signal `x` is padded by half the FFT size using reflection padding.
          pad_mode (str): Padding mode, which can be `'constant'` or `'reflect'`. `'constant'` pads with `0`.
  
      Returns:
          Returns real and imaginary parts of STFT result.
  
          * :obj:`~nnabla.Variable`: Real part of STFT of size `batch_size x fft_size//2 + 1 x frame_size`.
          * :obj:`~nnabla.Variable`: Imaginary part of STFT of size `batch x fft_size//2 + 1 x frame_size`.
      """
      from nnabla.parameter import (
          get_parameter,
          get_parameter_or_create,
      )
  
      conv_r = get_parameter("conv_r")
      conv_i = get_parameter("conv_i")
  
      if conv_r is None or conv_i is None:
          if window_type == "hanning":
              window_func = np.hanning(window_size + 1)[:-1]
          elif window_type == "hamming":
              window_func = np.hamming(window_size + 1)[:-1]
          elif window_type == "rectangular" or window_type is None:
              window_func = np.ones(window_size)
          else:
              raise ValueError(
                  "Unknown window type {}.".format(window_type)
              )
  
          # pad window if `fft_size > window_size`
          if fft_size > window_size:
              diff = fft_size - window_size
              window_func = np.pad(
                  window_func,
                  (diff // 2, diff - diff // 2),
                  mode="constant",
              )
          elif fft_size < window_size:
              raise ValueError(
                  "FFT size has to be as least as large as window size."
              )
  
          # compute STFT filter coefficients
          mat_r = np.zeros((fft_size // 2 + 1, 1, fft_size))
          mat_i = np.zeros((fft_size // 2 + 1, 1, fft_size))
  
          for w in range(fft_size // 2 + 1):
              for t in range(fft_size):
                  mat_r[w, 0, t] = np.cos(
                      2.0 * np.pi * w * t / fft_size
                  )
                  mat_i[w, 0, t] = -np.sin(
                      2.0 * np.pi * w * t / fft_size
                  )
          mat_r = mat_r * window_func
          mat_i = mat_i * window_func
  
          conv_r = get_parameter_or_create(
              "conv_r", initializer=mat_r, need_grad=False
          )
          conv_i = get_parameter_or_create(
              "conv_i", initializer=mat_i, need_grad=False
          )
  
      if center:
          # pad at begin/end (per default this is a reflection padding)
          x = pad(x, (fft_size // 2, fft_size // 2), mode=pad_mode)
  
      # add channel dimension
      x = reshape(x, (x.shape[0], 1, x.shape[1]))
  
      # compute STFT
      y_r = convolution(x, conv_r, stride=(stride,))
      y_i = convolution(x, conv_i, stride=(stride,))
  
      return y_r, y_i
  
imports: from __future__ import absolute_import
  from .function_bases import *
  from .None import dtypes
  import nnabla
  import numpy
  from .normalization_functions import *
  from .numpy_compat_functions import *
label_desc: Use image node_id 23 for calling a global function with example usage: _stft_v1(x, window_size, stride, fft_size, window_type, center, pad_mode) and returns: y_r,  y_i