Unverified Commit ada50e4e authored by Krishna Kalyan's avatar Krishna Kalyan Committed by GitHub
Browse files

Add autograd test for T.MelScale (#1467)

parent faf55235
...@@ -137,6 +137,16 @@ class AutogradTestMixin(TestBaseMixin): ...@@ -137,6 +137,16 @@ class AutogradTestMixin(TestBaseMixin):
waveform = get_whitenoise(sample_rate=sample_rate, duration=0.05, n_channels=2) waveform = get_whitenoise(sample_rate=sample_rate, duration=0.05, n_channels=2)
self.assert_grad(transform, [waveform]) self.assert_grad(transform, [waveform])
def test_melscale(self):
sample_rate = 8000
n_fft = 400
n_mels = n_fft // 2 + 1
transform = T.MelScale(sample_rate=sample_rate, n_mels=n_mels)
spec = get_spectrogram(
get_whitenoise(sample_rate=sample_rate, duration=0.05, n_channels=2),
n_fft=n_fft, power=1)
self.assert_grad(transform, [spec])
@parameterized.expand([(1.5, "amplitude"), (2, "power"), (10, "db")]) @parameterized.expand([(1.5, "amplitude"), (2, "power"), (10, "db")])
def test_vol(self, gain, gain_type): def test_vol(self, gain, gain_type):
sample_rate = 8000 sample_rate = 8000
......
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