Skip to content

Commit 1a64530

Browse files
hwangjeffnateanl
andauthored
[Fbsync] Update pitch shift batch consistency test (pytorch#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: Zhaoheng Ni <[email protected]>
1 parent 9c64184 commit 1a64530

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/torchaudio_unittest/transforms/batch_consistency_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@ def test_batch_spectral_centroid(self):
211211

212212
def test_batch_pitch_shift(self):
213213
sample_rate = 8000
214-
n_steps = 4
215-
waveform = common_utils.get_whitenoise(sample_rate=sample_rate)
214+
n_steps = -2
215+
waveform = common_utils.get_whitenoise(sample_rate=sample_rate, duration=0.05)
216216

217217
# Single then transform then batch
218-
expected = torchaudio.transforms.PitchShift(sample_rate, n_steps)(waveform).repeat(3, 1, 1)
218+
expected = torchaudio.transforms.PitchShift(sample_rate, n_steps, n_fft=400)(waveform).repeat(3, 1, 1)
219219

220220
# Batch then transform
221-
computed = torchaudio.transforms.PitchShift(sample_rate, n_steps)(waveform.repeat(3, 1, 1))
221+
computed = torchaudio.transforms.PitchShift(sample_rate, n_steps, n_fft=400)(waveform.repeat(3, 1, 1))
222222
self.assertEqual(computed, expected)

0 commit comments

Comments
 (0)