Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
mthrok committed Jun 17, 2020
1 parent 847e95d commit ab4315f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions test/test_batch_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


class TestFunctional(common_utils.TorchaudioTestCase):
backend = 'default'
"""Test functions defined in `functional` module"""
def assert_batch_consistency(
self, functional, tensor, *args, batch_size=1, atol=1e-8, rtol=1e-5, seed=42, **kwargs):
Expand Down Expand Up @@ -47,7 +48,6 @@ def test_griffinlim(self):
)

def test_detect_pitch_frequency(self):
common_utils.set_audio_backend('default')
filenames = [
'steam-train-whistle-daniel_simon.wav', # 2ch 44100Hz
# Files from https://www.mediacollege.com/audio/tone/download/
Expand Down Expand Up @@ -80,7 +80,6 @@ def test_overdrive(self):
self.assert_batch_consistencies(F.overdrive, waveform, gain=45, colour=30)

def test_phaser(self):
common_utils.set_audio_backend('default')
filepath = common_utils.get_asset_path("whitenoise.wav")
waveform, sample_rate = torchaudio.load(filepath)
self.assert_batch_consistencies(F.phaser, waveform, sample_rate)
Expand All @@ -106,6 +105,8 @@ def test_vad(self):


class TestTransforms(common_utils.TorchaudioTestCase):
backend = 'default'

"""Test suite for classes defined in `transforms` module"""
def test_batch_AmplitudeToDB(self):
spec = torch.rand((6, 201))
Expand Down Expand Up @@ -171,7 +172,6 @@ def test_batch_compute_deltas(self):
self.assertEqual(computed, expected)

def test_batch_mulaw(self):
common_utils.set_audio_backend('default')
test_filepath = common_utils.get_asset_path('steam-train-whistle-daniel_simon.wav')
waveform, _ = torchaudio.load(test_filepath) # (2, 278756), 44100

Expand All @@ -197,7 +197,6 @@ def test_batch_mulaw(self):
self.assertEqual(computed, expected)

def test_batch_spectrogram(self):
common_utils.set_audio_backend('default')
test_filepath = common_utils.get_asset_path('steam-train-whistle-daniel_simon.wav')
waveform, _ = torchaudio.load(test_filepath) # (2, 278756), 44100

Expand All @@ -209,7 +208,6 @@ def test_batch_spectrogram(self):
self.assertEqual(computed, expected)

def test_batch_melspectrogram(self):
common_utils.set_audio_backend('default')
test_filepath = common_utils.get_asset_path('steam-train-whistle-daniel_simon.wav')
waveform, _ = torchaudio.load(test_filepath) # (2, 278756), 44100

Expand All @@ -221,7 +219,6 @@ def test_batch_melspectrogram(self):
self.assertEqual(computed, expected)

def test_batch_mfcc(self):
common_utils.set_audio_backend('default')
test_filepath = common_utils.get_asset_path('steam-train-whistle-daniel_simon.wav')
waveform, _ = torchaudio.load(test_filepath)

Expand All @@ -233,7 +230,6 @@ def test_batch_mfcc(self):
self.assertEqual(computed, expected, atol=1e-4, rtol=1e-5)

def test_batch_TimeStretch(self):
common_utils.set_audio_backend('default')
test_filepath = common_utils.get_asset_path('steam-train-whistle-daniel_simon.wav')
waveform, _ = torchaudio.load(test_filepath) # (2, 278756), 44100

Expand Down Expand Up @@ -268,7 +264,6 @@ def test_batch_TimeStretch(self):
self.assertEqual(computed, expected, atol=1e-5, rtol=1e-5)

def test_batch_Fade(self):
common_utils.set_audio_backend('default')
test_filepath = common_utils.get_asset_path('steam-train-whistle-daniel_simon.wav')
waveform, _ = torchaudio.load(test_filepath) # (2, 278756), 44100
fade_in_len = 3000
Expand All @@ -282,7 +277,6 @@ def test_batch_Fade(self):
self.assertEqual(computed, expected)

def test_batch_Vol(self):
common_utils.set_audio_backend('default')
test_filepath = common_utils.get_asset_path('steam-train-whistle-daniel_simon.wav')
waveform, _ = torchaudio.load(test_filepath) # (2, 278756), 44100

Expand Down

0 comments on commit ab4315f

Please sign in to comment.