Skip to content

Commit a67ed63

Browse files
committed
update spectrogram test.
1 parent 4d676e0 commit a67ed63

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

test/test_transforms.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,14 @@ def test_compute_deltas_twochannel(self):
314314
self.assertTrue(computed.shape == specgram.shape, (computed.shape, specgram.shape))
315315

316316
def test_batch_spectrogram(self):
317-
waveform, sample_rate = torchaudio.load(self.test_filepath) # (2, 278756), 44100
317+
waveform, sample_rate = torchaudio.load(self.test_filepath)
318318

319319
# Single then transform then batch
320-
expected = Transform()(waveform).unsqueeze(0).repeat(3, 1, 1, 1)
320+
expected = transforms.Spectrogram()(waveform).repeat(3, 1, 1, 1)
321321

322322
# Batch then transform
323-
waveform = waveform.unsqueeze(0).repeat(3, 1, 1)
324-
computed = transforms.Spectrogram()(waveform)
323+
computed = transforms.Spectrogram()(waveform.repeat(3, 1, 1))
325324

326-
# shape = (3, 2, 201, 1394)
327325
self.assertTrue(computed.shape == expected.shape, (computed.shape, expected.shape))
328326
self.assertTrue(torch.allclose(computed, expected))
329327

0 commit comments

Comments
 (0)