Skip to content

Commit 3abb3ee

Browse files
committed
skip cuda test
1 parent 4a91bdb commit 3abb3ee

File tree

6 files changed

+54
-3
lines changed

6 files changed

+54
-3
lines changed
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import torch
22
from torchaudio_unittest.common_utils import PytorchTestCase
33

4-
from .autograd_test_impl import AutogradTestImpl
4+
from .autograd_test_impl import AutogradTestImpl, AutogradTestRIRImpl
55

66

77
class TestAutogradCPUFloat64(AutogradTestImpl, PytorchTestCase):
88
dtype = torch.float64
99
device = torch.device("cpu")
10+
11+
12+
class TestAutogradRIRCPUFloat64(AutogradTestRIRImpl, PytorchTestCase):
13+
dtype = torch.float64
14+
device = torch.device("cpu")

test/torchaudio_unittest/prototype/functional/autograd_test_impl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def test_add_noise(self):
3232
self.assertTrue(gradcheck(F.add_noise, (waveform, noise, lengths, snr)))
3333
self.assertTrue(gradgradcheck(F.add_noise, (waveform, noise, lengths, snr)))
3434

35+
36+
class AutogradTestRIRImpl(TestBaseMixin):
3537
@parameterized.expand([(2, 1), (3, 4)])
3638
def test_simulate_rir_ism(self, D, channel):
3739
room = torch.rand(D, dtype=self.dtype, device=self.device, requires_grad=True)

test/torchaudio_unittest/prototype/functional/functional_cpu_test.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import torch
22
from torchaudio_unittest.common_utils import PytorchTestCase
33

4-
from .functional_test_impl import FunctionalTestImpl
4+
from .functional_test_impl import FunctionalTestImpl, FunctionalTestRIRImpl
55

66

77
class FunctionalFloat32CPUTest(FunctionalTestImpl, PytorchTestCase):
@@ -12,3 +12,13 @@ class FunctionalFloat32CPUTest(FunctionalTestImpl, PytorchTestCase):
1212
class FunctionalFloat64CPUTest(FunctionalTestImpl, PytorchTestCase):
1313
dtype = torch.float64
1414
device = torch.device("cpu")
15+
16+
17+
class FunctionalRIRFloat32Test(FunctionalTestRIRImpl, PytorchTestCase):
18+
dtype = torch.float32
19+
device = torch.device("cpu")
20+
21+
22+
class FunctionalRIRFloat64Test(FunctionalTestRIRImpl, PytorchTestCase):
23+
dtype = torch.float64
24+
device = torch.device("cpu")

test/torchaudio_unittest/prototype/functional/functional_test_impl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import numpy as np
2+
23
try:
34
import pyroomacoustics as pra
45
except Exception:
@@ -112,6 +113,8 @@ def test_add_noise_length_check(self):
112113
with self.assertRaisesRegex(ValueError, "Length dimensions"):
113114
F.add_noise(waveform, noise, lengths, snr)
114115

116+
117+
class FunctionalTestRIRImpl(TestBaseMixin):
115118
@skipIfNoModule("pyroomacoustics")
116119
@parameterized.expand([(2, 1), (3, 4)])
117120
def test_simulate_rir_ism_single_band(self, D, channel):

test/torchaudio_unittest/prototype/functional/torchscript_consistency_cpu_test.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import torch
22
from torchaudio_unittest.common_utils import PytorchTestCase
33

4-
from .torchscript_consistency_test_impl import TorchScriptConsistencyTestImpl
4+
from .torchscript_consistency_test_impl import TorchScriptConsistencyTestImpl, TorchScriptConsistencyTestRIRImpl
55

66

77
class TorchScriptConsistencyCPUFloat32Test(TorchScriptConsistencyTestImpl, PytorchTestCase):
@@ -12,3 +12,13 @@ class TorchScriptConsistencyCPUFloat32Test(TorchScriptConsistencyTestImpl, Pytor
1212
class TorchScriptConsistencyCPUFloat64Test(TorchScriptConsistencyTestImpl, PytorchTestCase):
1313
dtype = torch.float64
1414
device = torch.device("cpu")
15+
16+
17+
class TorchScriptConsistencyRIRCPUFloat32Test(TorchScriptConsistencyTestRIRImpl, PytorchTestCase):
18+
dtype = torch.float32
19+
device = torch.device("cpu")
20+
21+
22+
class TorchScriptConsistencyRIRCPUFloat64Test(TorchScriptConsistencyTestRIRImpl, PytorchTestCase):
23+
dtype = torch.float64
24+
device = torch.device("cpu")

test/torchaudio_unittest/prototype/functional/torchscript_consistency_test_impl.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,27 @@ def test_add_noise(self):
4949

5050
self._assert_consistency(F.add_noise, (waveform, noise, lengths, snr))
5151

52+
53+
class TorchScriptConsistencyTestRIRImpl(TestBaseMixin):
54+
def _assert_consistency(self, func, inputs, shape_only=False):
55+
inputs_ = []
56+
for i in inputs:
57+
if torch.is_tensor(i):
58+
i = i.to(device=self.device, dtype=self.dtype)
59+
inputs_.append(i)
60+
ts_func = torch_script(func)
61+
62+
torch.random.manual_seed(40)
63+
output = func(*inputs_)
64+
65+
torch.random.manual_seed(40)
66+
ts_output = ts_func(*inputs_)
67+
68+
if shape_only:
69+
ts_output = ts_output.shape
70+
output = output.shape
71+
self.assertEqual(ts_output, output)
72+
5273
@parameterized.expand([(2, 1), (3, 4)])
5374
def test_simulate_rir_ism_single_band(self, D, channel):
5475
room_dim = torch.rand(D, dtype=self.dtype, device=self.device) + 5

0 commit comments

Comments
 (0)