Unverified Commit e868d24c authored by Aobo Yang's avatar Aobo Yang Committed by GitHub
Browse files

Add test for validating lfilter shape (#1360)

parent 7ab08200
...@@ -31,6 +31,20 @@ class Lfilter(common_utils.TestBaseMixin): ...@@ -31,6 +31,20 @@ class Lfilter(common_utils.TestBaseMixin):
output_signal = F.lfilter(input_signal, a_coeffs, b_coeffs, clamp=False) output_signal = F.lfilter(input_signal, a_coeffs, b_coeffs, clamp=False)
assert output_signal.max() > 1 assert output_signal.max() > 1
@parameterized.expand([
((44100,),),
((3, 44100),),
((2, 3, 44100),),
((1, 2, 3, 44100),)
])
def test_shape(self, shape):
torch.random.manual_seed(42)
waveform = torch.rand(*shape, dtype=self.dtype, device=self.device)
b_coeffs = torch.tensor([0, 0, 0, 1], dtype=self.dtype, device=self.device)
a_coeffs = torch.tensor([1, 0, 0, 0], dtype=self.dtype, device=self.device)
output_waveform = F.lfilter(waveform, a_coeffs, b_coeffs)
assert shape == waveform.size() == output_waveform.size()
class Spectrogram(common_utils.TestBaseMixin): class Spectrogram(common_utils.TestBaseMixin):
@parameterized.expand([(0., ), (1., ), (2., ), (3., )]) @parameterized.expand([(0., ), (1., ), (2., ), (3., )])
......
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