code: def test_gradients_numerical(
      self,
      signal_length,
      frame_length,
      frame_step,
      fft_length,
      np_rtype,
      forward_tol,
      backward_tol,
  ):
      # TODO(rjryan): Investigate why STFT gradient error is so high.
      signal = np.random.rand(signal_length).astype(np_rtype) * 2 - 1
  
      def forward(signal):
          return spectral_ops.stft(
              signal,
              frame_length,
              frame_step,
              fft_length,
              pad_end=False,
          )
  
      (
          (f_jacob_t,),
          (f_jacob_n,),
      ) = gradient_checker_v2.compute_gradient(forward, [signal])
      self.assertAllClose(
          f_jacob_t, f_jacob_n, rtol=forward_tol, atol=forward_tol
      )
  
      def backward(stft):
          return spectral_ops.inverse_stft(
              stft, frame_length, frame_step, fft_length
          )
  
      stft = forward(signal)
      (
          (b_jacob_t,),
          (b_jacob_n,),
      ) = gradient_checker_v2.compute_gradient(backward, [stft])
      self.assertAllClose(
          b_jacob_t, b_jacob_n, rtol=backward_tol, atol=backward_tol
      )
  
imports: import itertools
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.signal import spectral_ops
  from tensorflow.python.ops.signal import window_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 14 for calling the SpectralOpsTest obj's underlying member method code with example usage: obj.test_gradients_numerical(signal_length, frame_length, frame_step, fft_length, np_rtype, forward_tol, backward_tol) and returns: spectral_ops, spectral_ops