From 45f7ff5bd29c01e390d12289f459cf086e488a8e Mon Sep 17 00:00:00 2001 From: Chin Yun Yu Date: Thu, 1 Apr 2021 14:33:02 +0800 Subject: [PATCH 1/5] refactor: make tests look simpler --- .../functional/autograd_impl.py | 165 ++++++++++-------- 1 file changed, 92 insertions(+), 73 deletions(-) diff --git a/test/torchaudio_unittest/functional/autograd_impl.py b/test/torchaudio_unittest/functional/autograd_impl.py index caa444c988..9c2c512140 100644 --- a/test/torchaudio_unittest/functional/autograd_impl.py +++ b/test/torchaudio_unittest/functional/autograd_impl.py @@ -1,138 +1,157 @@ +from typing import Callable, List, Tuple import torch +from torch import functional +from torch.tensor import Tensor import torchaudio.functional as F from torch.autograd import gradcheck -from torchaudio_unittest import common_utils +from torchaudio_unittest.common_utils import ( + TestBaseMixin, + get_whitenoise, +) + + +class Autograd(TestBaseMixin): + def assert_grad( + self, + transform: Callable[..., Tensor], + inputs: Tuple[torch.Tensor], + *, + enable_all_grad: bool = True, + ): + inputs_ = [] + for i in inputs: + if torch.is_tensor(i): + if enable_all_grad: + i.requires_grad = True + i = i.to(dtype=self.dtype, device=self.device) + inputs_.append(i) + assert gradcheck(transform, inputs_) - -class Autograd(common_utils.TestBaseMixin): def test_lfilter_x(self): torch.random.manual_seed(2434) - x = torch.rand(2, 4, 256 * 2, dtype=self.dtype, device=self.device) - a = torch.tensor([0.7, 0.2, 0.6], dtype=self.dtype, device=self.device) - b = torch.tensor([0.4, 0.2, 0.9], dtype=self.dtype, device=self.device) + x = get_whitenoise(sample_rate=22050, duration=0.025, n_channels=2) + a = torch.tensor([0.7, 0.2, 0.6]) + b = torch.tensor([0.4, 0.2, 0.9]) x.requires_grad = True - assert gradcheck(F.lfilter, (x, a, b), eps=1e-10) + self.assert_grad(F.lfilter, (x, a, b), enable_all_grad=False) def test_lfilter_a(self): torch.random.manual_seed(2434) - x = torch.rand(2, 4, 256 * 2, dtype=self.dtype, device=self.device) - a = torch.tensor([0.7, 0.2, 0.6], dtype=self.dtype, device=self.device) - b = torch.tensor([0.4, 0.2, 0.9], dtype=self.dtype, device=self.device) + x = get_whitenoise(sample_rate=22050, duration=0.05, n_channels=2) + a = torch.tensor([0.7, 0.2, 0.6]) + b = torch.tensor([0.4, 0.2, 0.9]) a.requires_grad = True - assert gradcheck(F.lfilter, (x, a, b), eps=1e-10) + self.assert_grad(F.lfilter, (x, a, b), enable_all_grad=False) def test_lfilter_b(self): torch.random.manual_seed(2434) - x = torch.rand(2, 4, 256 * 2, dtype=self.dtype, device=self.device) - a = torch.tensor([0.7, 0.2, 0.6], dtype=self.dtype, device=self.device) - b = torch.tensor([0.4, 0.2, 0.9], dtype=self.dtype, device=self.device) + x = get_whitenoise(sample_rate=22050, duration=0.05, n_channels=2) + a = torch.tensor([0.7, 0.2, 0.6]) + b = torch.tensor([0.4, 0.2, 0.9]) b.requires_grad = True - assert gradcheck(F.lfilter, (x, a, b), eps=1e-10) + self.assert_grad(F.lfilter, (x, a, b), enable_all_grad=False) def test_lfilter_all_inputs(self): torch.random.manual_seed(2434) - x = torch.rand(2, 4, 256 * 2, dtype=self.dtype, device=self.device) - a = torch.tensor([0.7, 0.2, 0.6], dtype=self.dtype, device=self.device) - b = torch.tensor([0.4, 0.2, 0.9], dtype=self.dtype, device=self.device) - b.requires_grad = True - a.requires_grad = True - x.requires_grad = True - assert gradcheck(F.lfilter, (x, a, b), eps=1e-10) + x = get_whitenoise(sample_rate=22050, duration=0.05, n_channels=2) + a = torch.tensor([0.7, 0.2, 0.6]) + b = torch.tensor([0.4, 0.2, 0.9]) + self.assert_grad(F.lfilter, (x, a, b)) def test_biquad(self): torch.random.manual_seed(2434) - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - a = torch.tensor([0.7, 0.2, 0.6], dtype=self.dtype, device=self.device, requires_grad=True) - b = torch.tensor([0.4, 0.2, 0.9], dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.biquad, (x, b[0], b[1], b[2], a[0], a[1], a[2]), eps=1e-10) + x = get_whitenoise(sample_rate=22050, duration=0.05, n_channels=2) + a = torch.tensor([0.7, 0.2, 0.6]) + b = torch.tensor([0.4, 0.2, 0.9]) + self.assert_grad(F.biquad, (x, b[0], b[1], b[2], a[0], a[1], a[2])) def test_band_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.band_biquad, (x, sr, central_freq, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + self.assert_grad(F.band_biquad, (x, sr, central_freq, Q)) def test_band_biquad_with_noise(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.band_biquad, (x, sr, central_freq, Q, True)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + self.assert_grad(F.band_biquad, (x, sr, central_freq, Q, True)) def test_bass_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(100, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - gain = torch.tensor(10, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.bass_biquad, (x, sr, gain, central_freq, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(100.) + Q = torch.tensor(0.7) + gain = torch.tensor(10.) + self.assert_grad(F.bass_biquad, (x, sr, gain, central_freq, Q)) def test_treble_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(3000, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - gain = torch.tensor(10, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.treble_biquad, (x, sr, gain, central_freq, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(3000.) + Q = torch.tensor(0.7) + gain = torch.tensor(10.) + self.assert_grad(F.treble_biquad, (x, sr, gain, central_freq, Q)) def test_allpass_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.allpass_biquad, (x, sr, central_freq, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + self.assert_grad(F.allpass_biquad, (x, sr, central_freq, Q)) def test_lowpass_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - cutoff_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.lowpass_biquad, (x, sr, cutoff_freq, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + cutoff_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + self.assert_grad(F.lowpass_biquad, (x, sr, cutoff_freq, Q)) def test_highpass_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - cutoff_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.highpass_biquad, (x, sr, cutoff_freq, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + cutoff_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + self.assert_grad(F.highpass_biquad, (x, sr, cutoff_freq, Q)) def test_bandpass_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.bandpass_biquad, (x, sr, central_freq, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + self.assert_grad(F.bandpass_biquad, (x, sr, central_freq, Q)) def test_bandpass_biquad_with_const_skirt_gain(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.bandpass_biquad, (x, sr, central_freq, Q, True)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + self.assert_grad(F.bandpass_biquad, (x, sr, central_freq, Q, True)) def test_equalizer_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - gain = torch.tensor(10, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.equalizer_biquad, (x, sr, central_freq, gain, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + gain = torch.tensor(10.) + self.assert_grad(F.equalizer_biquad, (x, sr, central_freq, gain, Q)) def test_bandreject_biquad(self): torch.random.manual_seed(2434) sr = 22050 - x = torch.rand(1024, dtype=self.dtype, device=self.device, requires_grad=True) - central_freq = torch.tensor(800, dtype=self.dtype, device=self.device, requires_grad=True) - Q = torch.tensor(0.7, dtype=self.dtype, device=self.device, requires_grad=True) - assert gradcheck(F.bandreject_biquad, (x, sr, central_freq, Q)) + x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) + central_freq = torch.tensor(800.) + Q = torch.tensor(0.7) + self.assert_grad(F.bandreject_biquad, (x, sr, central_freq, Q)) From caa37119a2e877d0c9137e7bfda1a51268ebf914 Mon Sep 17 00:00:00 2001 From: Chin Yun Yu Date: Wed, 7 Apr 2021 09:57:57 +0800 Subject: [PATCH 2/5] fix: import errors --- test/torchaudio_unittest/functional/autograd_impl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/torchaudio_unittest/functional/autograd_impl.py b/test/torchaudio_unittest/functional/autograd_impl.py index 9c2c512140..821121f274 100644 --- a/test/torchaudio_unittest/functional/autograd_impl.py +++ b/test/torchaudio_unittest/functional/autograd_impl.py @@ -1,7 +1,7 @@ from typing import Callable, List, Tuple import torch from torch import functional -from torch.tensor import Tensor +from torch import Tensor import torchaudio.functional as F from torch.autograd import gradcheck from torchaudio_unittest.common_utils import ( From bd958dd62d4e3f3e5d3350c5ffda4d2388db03e8 Mon Sep 17 00:00:00 2001 From: Chin Yun Yu Date: Wed, 7 Apr 2021 10:25:17 +0800 Subject: [PATCH 3/5] test: expand more test cases --- .../functional/autograd_impl.py | 162 ++++++++++++------ 1 file changed, 110 insertions(+), 52 deletions(-) diff --git a/test/torchaudio_unittest/functional/autograd_impl.py b/test/torchaudio_unittest/functional/autograd_impl.py index 821121f274..14ee19b31e 100644 --- a/test/torchaudio_unittest/functional/autograd_impl.py +++ b/test/torchaudio_unittest/functional/autograd_impl.py @@ -1,6 +1,6 @@ from typing import Callable, List, Tuple import torch -from torch import functional +from parameterized import parameterized from torch import Tensor import torchaudio.functional as F from torch.autograd import gradcheck @@ -21,9 +21,9 @@ def assert_grad( inputs_ = [] for i in inputs: if torch.is_tensor(i): + i = i.to(dtype=self.dtype, device=self.device) if enable_all_grad: i.requires_grad = True - i = i.to(dtype=self.dtype, device=self.device) inputs_.append(i) assert gradcheck(transform, inputs_) @@ -65,93 +65,151 @@ def test_biquad(self): b = torch.tensor([0.4, 0.2, 0.9]) self.assert_grad(F.biquad, (x, b[0], b[1], b[2], a[0], a[1], a[2])) - def test_band_biquad(self): - torch.random.manual_seed(2434) - sr = 22050 - x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(800.) - Q = torch.tensor(0.7) - self.assert_grad(F.band_biquad, (x, sr, central_freq, Q)) - - def test_band_biquad_with_noise(self): + @parameterized.expand([ + (800, 0.7, True), + (800, 2, True), + (4000, 0.7, True), + (4000, 2, True), + (800, 0.7, False), + (800, 2, False), + (4000, 0.7, False), + (4000, 2, False), + ]) + def test_band_biquad(self, central_freq, Q, noise): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(800.) - Q = torch.tensor(0.7) - self.assert_grad(F.band_biquad, (x, sr, central_freq, Q, True)) - - def test_bass_biquad(self): + central_freq = torch.tensor(central_freq) + Q = torch.tensor(Q) + self.assert_grad(F.band_biquad, (x, sr, central_freq, Q, noise)) + + @parameterized.expand([ + (800, 0.7, 10), + (800, 2, 10), + (100, 0.7, 10), + (100, 2, 10), + (800, 0.7, -10), + (800, 2, -10), + (100, 0.7, -10), + (100, 2, -10), + ]) + def test_bass_biquad(self, central_freq, Q, gain): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(100.) - Q = torch.tensor(0.7) - gain = torch.tensor(10.) + central_freq = torch.tensor(central_freq) + Q = torch.tensor(Q) + gain = torch.tensor(gain) self.assert_grad(F.bass_biquad, (x, sr, gain, central_freq, Q)) - def test_treble_biquad(self): + @parameterized.expand([ + (3000, 0.7, 10), + (3000, 2, 10), + (8000, 0.7, 10), + (8000, 2, 10), + (3000, 0.7, -10), + (3000, 2, -10), + (8000, 0.7, -10), + (8000, 2, -10), + ]) + def test_treble_biquad(self, central_freq, Q, gain): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(3000.) - Q = torch.tensor(0.7) - gain = torch.tensor(10.) + central_freq = torch.tensor(central_freq) + Q = torch.tensor(Q) + gain = torch.tensor(gain) self.assert_grad(F.treble_biquad, (x, sr, gain, central_freq, Q)) - def test_allpass_biquad(self): + @parameterized.expand([ + (800, 0.7, ), + (800, 2, ), + (4000, 0.7, ), + (4000, 2, ), + ]) + def test_allpass_biquad(self, central_freq, Q): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(800.) - Q = torch.tensor(0.7) + central_freq = torch.tensor(central_freq) + Q = torch.tensor(Q) self.assert_grad(F.allpass_biquad, (x, sr, central_freq, Q)) - def test_lowpass_biquad(self): + @parameterized.expand([ + (800, 0.7, ), + (800, 2, ), + (8000, 0.7, ), + (8000, 2, ), + ]) + def test_lowpass_biquad(self, cutoff_freq, Q): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - cutoff_freq = torch.tensor(800.) - Q = torch.tensor(0.7) + cutoff_freq = torch.tensor(cutoff_freq) + Q = torch.tensor(Q) self.assert_grad(F.lowpass_biquad, (x, sr, cutoff_freq, Q)) - def test_highpass_biquad(self): + @parameterized.expand([ + (800, 0.7, ), + (800, 2, ), + (100, 0.7, ), + (100, 2, ), + ]) + def test_highpass_biquad(self, cutoff_freq, Q): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - cutoff_freq = torch.tensor(800.) - Q = torch.tensor(0.7) + cutoff_freq = torch.tensor(cutoff_freq) + Q = torch.tensor(Q) self.assert_grad(F.highpass_biquad, (x, sr, cutoff_freq, Q)) - def test_bandpass_biquad(self): - torch.random.manual_seed(2434) - sr = 22050 - x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(800.) - Q = torch.tensor(0.7) - self.assert_grad(F.bandpass_biquad, (x, sr, central_freq, Q)) - - def test_bandpass_biquad_with_const_skirt_gain(self): + @parameterized.expand([ + (800, 0.7, True), + (800, 2, True), + (4000, 0.7, True), + (4000, 2, True), + (800, 0.7, False), + (800, 2, False), + (4000, 0.7, False), + (4000, 2, False), + ]) + def test_bandpass_biquad(self, central_freq, Q, const_skirt_gain): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(800.) - Q = torch.tensor(0.7) - self.assert_grad(F.bandpass_biquad, (x, sr, central_freq, Q, True)) - - def test_equalizer_biquad(self): + central_freq = torch.tensor(central_freq) + Q = torch.tensor(Q) + self.assert_grad(F.bandpass_biquad, (x, sr, central_freq, Q, const_skirt_gain)) + + @parameterized.expand([ + (800, 0.7, 10), + (800, 2, 10), + (4000, 0.7, 10), + (4000, 2, 10), + (800, 0.7, -10), + (800, 2, -10), + (4000, 0.7, -10), + (4000, 2, -10), + ]) + def test_equalizer_biquad(self, central_freq, Q, gain): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(800.) - Q = torch.tensor(0.7) - gain = torch.tensor(10.) + central_freq = torch.tensor(central_freq) + Q = torch.tensor(Q) + gain = torch.tensor(gain) self.assert_grad(F.equalizer_biquad, (x, sr, central_freq, gain, Q)) - def test_bandreject_biquad(self): + @parameterized.expand([ + (800, 0.7, ), + (800, 2, ), + (4000, 0.7, ), + (4000, 2, ), + ]) + def test_bandreject_biquad(self, central_freq, Q): torch.random.manual_seed(2434) sr = 22050 x = get_whitenoise(sample_rate=sr, duration=0.05, n_channels=2) - central_freq = torch.tensor(800.) - Q = torch.tensor(0.7) + central_freq = torch.tensor(central_freq) + Q = torch.tensor(Q) self.assert_grad(F.bandreject_biquad, (x, sr, central_freq, Q)) From b42b16a6100894cc094bafc3e85fb712f91f19d9 Mon Sep 17 00:00:00 2001 From: Chin Yun Yu Date: Wed, 7 Apr 2021 10:54:00 +0800 Subject: [PATCH 4/5] refactor: remove unused import --- test/torchaudio_unittest/functional/autograd_impl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/torchaudio_unittest/functional/autograd_impl.py b/test/torchaudio_unittest/functional/autograd_impl.py index 14ee19b31e..31851b0d16 100644 --- a/test/torchaudio_unittest/functional/autograd_impl.py +++ b/test/torchaudio_unittest/functional/autograd_impl.py @@ -1,4 +1,4 @@ -from typing import Callable, List, Tuple +from typing import Callable, Tuple import torch from parameterized import parameterized from torch import Tensor From 511003431a300411242ac6d47f19e305767348d0 Mon Sep 17 00:00:00 2001 From: Chin Yun Yu Date: Wed, 7 Apr 2021 22:32:52 +0800 Subject: [PATCH 5/5] test: reduce test cases --- .../functional/autograd_impl.py | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/test/torchaudio_unittest/functional/autograd_impl.py b/test/torchaudio_unittest/functional/autograd_impl.py index 31851b0d16..2d9dca76d6 100644 --- a/test/torchaudio_unittest/functional/autograd_impl.py +++ b/test/torchaudio_unittest/functional/autograd_impl.py @@ -67,13 +67,7 @@ def test_biquad(self): @parameterized.expand([ (800, 0.7, True), - (800, 2, True), - (4000, 0.7, True), - (4000, 2, True), (800, 0.7, False), - (800, 2, False), - (4000, 0.7, False), - (4000, 2, False), ]) def test_band_biquad(self, central_freq, Q, noise): torch.random.manual_seed(2434) @@ -85,13 +79,7 @@ def test_band_biquad(self, central_freq, Q, noise): @parameterized.expand([ (800, 0.7, 10), - (800, 2, 10), - (100, 0.7, 10), - (100, 2, 10), (800, 0.7, -10), - (800, 2, -10), - (100, 0.7, -10), - (100, 2, -10), ]) def test_bass_biquad(self, central_freq, Q, gain): torch.random.manual_seed(2434) @@ -104,13 +92,8 @@ def test_bass_biquad(self, central_freq, Q, gain): @parameterized.expand([ (3000, 0.7, 10), - (3000, 2, 10), - (8000, 0.7, 10), - (8000, 2, 10), (3000, 0.7, -10), - (3000, 2, -10), - (8000, 0.7, -10), - (8000, 2, -10), + ]) def test_treble_biquad(self, central_freq, Q, gain): torch.random.manual_seed(2434) @@ -123,9 +106,6 @@ def test_treble_biquad(self, central_freq, Q, gain): @parameterized.expand([ (800, 0.7, ), - (800, 2, ), - (4000, 0.7, ), - (4000, 2, ), ]) def test_allpass_biquad(self, central_freq, Q): torch.random.manual_seed(2434) @@ -137,9 +117,6 @@ def test_allpass_biquad(self, central_freq, Q): @parameterized.expand([ (800, 0.7, ), - (800, 2, ), - (8000, 0.7, ), - (8000, 2, ), ]) def test_lowpass_biquad(self, cutoff_freq, Q): torch.random.manual_seed(2434) @@ -151,9 +128,6 @@ def test_lowpass_biquad(self, cutoff_freq, Q): @parameterized.expand([ (800, 0.7, ), - (800, 2, ), - (100, 0.7, ), - (100, 2, ), ]) def test_highpass_biquad(self, cutoff_freq, Q): torch.random.manual_seed(2434) @@ -165,13 +139,7 @@ def test_highpass_biquad(self, cutoff_freq, Q): @parameterized.expand([ (800, 0.7, True), - (800, 2, True), - (4000, 0.7, True), - (4000, 2, True), (800, 0.7, False), - (800, 2, False), - (4000, 0.7, False), - (4000, 2, False), ]) def test_bandpass_biquad(self, central_freq, Q, const_skirt_gain): torch.random.manual_seed(2434) @@ -183,13 +151,7 @@ def test_bandpass_biquad(self, central_freq, Q, const_skirt_gain): @parameterized.expand([ (800, 0.7, 10), - (800, 2, 10), - (4000, 0.7, 10), - (4000, 2, 10), (800, 0.7, -10), - (800, 2, -10), - (4000, 0.7, -10), - (4000, 2, -10), ]) def test_equalizer_biquad(self, central_freq, Q, gain): torch.random.manual_seed(2434) @@ -202,9 +164,6 @@ def test_equalizer_biquad(self, central_freq, Q, gain): @parameterized.expand([ (800, 0.7, ), - (800, 2, ), - (4000, 0.7, ), - (4000, 2, ), ]) def test_bandreject_biquad(self, central_freq, Q): torch.random.manual_seed(2434)