code: def check_nola_violation(
      y_r,
      y_i,
      window_size,
      stride,
      fft_size,
      window_type,
      center,
      pad_mode,
      as_stft_backward,
  ):
      # Check reference raise
      try:
          # Use PyTorch to check NOLA condition because librosa does not raise.
          # If PyTorch is not installed, NOLA condition test for reference is skipped.
          import torch
  
          def ref_istft_torch(
              y_r,
              y_i,
              window_size,
              stride,
              fft_size,
              window_type,
              center,
          ):
              y_r = np.reshape(y_r, y_r.shape + (1,))
              y_i = np.reshape(y_i, y_i.shape + (1,))
              y = np.concatenate((y_r, y_i), axis=3)
  
              y = torch.tensor(y)
              y = torch.view_as_complex(y)
              window = torch.tensor(
                  create_window_func(window_type, window_size)
              )
  
              x_shape = create_stft_input_shape(window_size)
              length = x_shape[1]
  
              x = torch.istft(
                  y,
                  n_fft=fft_size,
                  hop_length=stride,
                  win_length=window_size,
                  window=window,
                  center=center,
                  length=length,
              )
              return x
  
          with pytest.raises(RuntimeError, match=r"window overlap add"):
              # NOLA condition is checked during forward execution.
              ref_istft_torch(
                  y_r,
                  y_i,
                  window_size,
                  stride,
                  fft_size,
                  window_type,
                  center,
              )
      except:
          # Install PyTorch to check NOLA condition validation of reference istft.
          pass
  
      # Check NNabla raise
      y_r = nn.Variable.from_numpy_array(y_r)
      y_i = nn.Variable.from_numpy_array(y_i)
      with pytest.raises(
          RuntimeError,
          match=r"NOLA\(Nonzero Overlap Add\) condition is not met.",
      ):
          # NOLA condition is checked during setup.
          _ = F.istft(
              y_r,
              y_i,
              window_size,
              stride,
              fft_size,
              window_type,
              center,
              pad_mode,
              as_stft_backward,
          )
  
file_path: nnabla/python/test/function/test_istft.py
imports: from operator import is_
  import pytest
  import numpy
  import nnabla
  import nnabla.functions
  import scipy.signal
  import librosa
  from nbla_test_utils import list_context
  from test_stft import create_stft_input_shape, create_window_func, is_nola_violation, ref_stft
label_desc: Use image node_id 2 for calling a global function with example usage: check_nola_violation(y_r, y_i, window_size, stride, fft_size, window_type, center, pad_mode, as_stft_backward) and returns: x