Commit 75fc9a46 authored by Zhaoheng Ni's avatar Zhaoheng Ni Committed by Facebook GitHub Bot
Browse files

Fix unit tests for griffinlim and Spectrogram (#3099)

Summary: Pull Request resolved: https://github.com/pytorch/audio/pull/3099

Reviewed By: mthrok

Differential Revision: D43596866

Pulled By: nateanl

fbshipit-source-id: 43a139bf8ebdf3261414e2855aefc3b53df298ac
parent fd778091
...@@ -65,7 +65,7 @@ class TestFunctional(common_utils.TorchaudioTestCase): ...@@ -65,7 +65,7 @@ class TestFunctional(common_utils.TorchaudioTestCase):
"rand_init": False, "rand_init": False,
} }
func = partial(F.griffinlim, **kwargs) func = partial(F.griffinlim, **kwargs)
self.assert_batch_consistency(func, inputs=(batch,), atol=5e-5) self.assert_batch_consistency(func, inputs=(batch,), atol=1e-4)
@parameterized.expand( @parameterized.expand(
list( list(
......
...@@ -36,7 +36,7 @@ class TransformsTestBase(TestBaseMixin): ...@@ -36,7 +36,7 @@ class TransformsTestBase(TestBaseMixin):
result = T.Spectrogram(n_fft=n_fft, hop_length=hop_length, power=power,).to(self.device, self.dtype)( result = T.Spectrogram(n_fft=n_fft, hop_length=hop_length, power=power,).to(self.device, self.dtype)(
waveform waveform
)[0] )[0]
self.assertEqual(result, torch.from_numpy(expected), atol=1e-5, rtol=1e-5) self.assertEqual(result, torch.from_numpy(expected), atol=1e-4, rtol=1e-4)
def test_Spectrogram_complex(self): def test_Spectrogram_complex(self):
n_fft = 400 n_fft = 400
...@@ -54,7 +54,7 @@ class TransformsTestBase(TestBaseMixin): ...@@ -54,7 +54,7 @@ class TransformsTestBase(TestBaseMixin):
result = T.Spectrogram(n_fft=n_fft, hop_length=hop_length, power=None, return_complex=True,).to( result = T.Spectrogram(n_fft=n_fft, hop_length=hop_length, power=None, return_complex=True,).to(
self.device, self.dtype self.device, self.dtype
)(waveform)[0] )(waveform)[0]
self.assertEqual(result.abs(), torch.from_numpy(expected), atol=1e-5, rtol=1e-5) self.assertEqual(result.abs(), torch.from_numpy(expected), atol=1e-4, rtol=1e-4)
@nested_params( @nested_params(
[ [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment