Unverified Commit 1a64530d authored by hwangjeff's avatar hwangjeff Committed by GitHub
Browse files

[Fbsync] Update pitch shift batch consistency test (#1700)



* Reduce length of waveform in pitch_shift batch_consistency test

Summary: To address the test failure in T96406395

Reviewed By: carolineechen

Differential Revision: D30163741

fbshipit-source-id: f88d86b3da7b1ee52518934567b0b0a62700ee58

* Fix batch consistency test in transforms

Summary: The stress test still fails. Add n_fft to address it.

Reviewed By: mthrok

Differential Revision: D30218279

fbshipit-source-id: 7858efd3e5ac0073193a7883fd314486efc73814
Co-authored-by: default avatarZhaoheng Ni <zni@fb.com>
parent 9c641849
...@@ -211,12 +211,12 @@ class TestTransforms(common_utils.TorchaudioTestCase): ...@@ -211,12 +211,12 @@ class TestTransforms(common_utils.TorchaudioTestCase):
def test_batch_pitch_shift(self): def test_batch_pitch_shift(self):
sample_rate = 8000 sample_rate = 8000
n_steps = 4 n_steps = -2
waveform = common_utils.get_whitenoise(sample_rate=sample_rate) waveform = common_utils.get_whitenoise(sample_rate=sample_rate, duration=0.05)
# Single then transform then batch # Single then transform then batch
expected = torchaudio.transforms.PitchShift(sample_rate, n_steps)(waveform).repeat(3, 1, 1) expected = torchaudio.transforms.PitchShift(sample_rate, n_steps, n_fft=400)(waveform).repeat(3, 1, 1)
# Batch then transform # Batch then transform
computed = torchaudio.transforms.PitchShift(sample_rate, n_steps)(waveform.repeat(3, 1, 1)) computed = torchaudio.transforms.PitchShift(sample_rate, n_steps, n_fft=400)(waveform.repeat(3, 1, 1))
self.assertEqual(computed, expected) self.assertEqual(computed, expected)
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