def test_gradients(self):
    'Test that spectral_ops.stft has a working gradient.'
    if context.executing_eagerly():
        return
    with self.session() as sess:
        signal_length = 512
        empty_signal = array_ops.zeros([signal_length], dtype=dtypes.float32)
        empty_signal_gradient = sess.run(self._compute_stft_gradient(empty_signal))
        self.assertTrue((empty_signal_gradient == 0.0).all())
        sinusoid = math_ops.sin(((2 * np.pi) * math_ops.linspace(0.0, 1.0, signal_length)))
        sinusoid_gradient = self.evaluate(self._compute_stft_gradient(sinusoid))
        self.assertFalse((sinusoid_gradient == 0.0).all())
Test that spectral_ops.stft has a working gradient.
def test_gradients(self):
    
    if context.executing_eagerly():
        return
    with self.session() as sess:
        signal_length = 512
        empty_signal = array_ops.zeros([signal_length], dtype=dtypes.float32)
        empty_signal_gradient = sess.run(self._compute_stft_gradient(empty_signal))
        self.assertTrue((empty_signal_gradient == 0.0).all())
        sinusoid = math_ops.sin(((2 * np.pi) * math_ops.linspace(0.0, 1.0, signal_length)))
        sinusoid_gradient = self.evaluate(self._compute_stft_gradient(sinusoid))
        self.assertFalse((sinusoid_gradient == 0.0).all())