code: def test_stft_forward_backward(
      ctx,
      seed,
      window_size,
      stride,
      fft_size,
      window_type,
      center,
      pad_mode,
      as_istft_backward,
  ):
      backend = ctx.backend[0].split(":")[0]
      if backend == "cuda":
          pytest.skip(
              "CUDA Convolution N-D is only supported in CUDNN extension"
          )
      func_name = "STFTCuda" if backend == "cudnn" else "STFT"
  
      from nbla_test_utils import function_tester
  
      rng = np.random.RandomState(seed)
  
      x_shape = create_stft_input_shape(window_size)
      inputs = [rng.randn(*x_shape).astype(np.float32)]
  
      # Some conditions are skipped for the reason of use of ISTFT function.
      if as_istft_backward:
          # Ignore violation of NOLA condition
          length = x_shape[1]
          if is_nola_violation(
              window_type, window_size, stride, fft_size, length, center
          ):
              pytest.skip("NOLA condition violation.")
  
          if pad_mode != "constant":
              pytest.skip(
                  '`pad_mode` must be "constant" when `as_istft_backward == True`. Normal ISTFT never use `pad_mode` and just slice the output. Thus, STFT as a backward of normal ISTFT, STFT must be `pad_mode == constant`'
              )
  
      function_tester(
          rng,
          F.stft,
          ref_stft,
          inputs,
          func_args=[
              window_size,
              stride,
              fft_size,
              window_type,
              center,
              pad_mode,
              as_istft_backward,
          ],
          ctx=ctx,
          func_name=func_name,
          atol_f=2e-6,
          atol_b=2e-2,
          dstep=1e-2,
      )
  
file_path: nnabla/python/test/function/test_stft.py
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  import librosa
  from nbla_test_utils import list_context
label_desc: Use image node_id 6 for calling a global function with example usage: test_stft_forward_backward(ctx, seed, window_size, stride, fft_size, window_type, center, pad_mode, as_istft_backward) without return types