Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
512c2fa4
Unverified
Commit
512c2fa4
authored
Mar 29, 2021
by
Krishna Kalyan
Committed by
GitHub
Mar 29, 2021
Browse files
Remove skipIfNoSoxBackend (#1390)
Co-authored-by:
krishnakalyan3
<
skalyan@cloudera.com
>
parent
14dd917e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
10 deletions
+15
-10
test/torchaudio_unittest/common_utils/__init__.py
test/torchaudio_unittest/common_utils/__init__.py
+0
-1
test/torchaudio_unittest/common_utils/case_utils.py
test/torchaudio_unittest/common_utils/case_utils.py
+0
-3
test/torchaudio_unittest/compliance_kaldi_test.py
test/torchaudio_unittest/compliance_kaldi_test.py
+1
-2
test/torchaudio_unittest/functional/sox_compatibility_test.py
.../torchaudio_unittest/functional/sox_compatibility_test.py
+2
-2
test/torchaudio_unittest/transforms/sox_compatibility_test.py
.../torchaudio_unittest/transforms/sox_compatibility_test.py
+12
-2
No files found.
test/torchaudio_unittest/common_utils/__init__.py
View file @
512c2fa4
...
...
@@ -17,7 +17,6 @@ from .case_utils import (
skipIfNoModule
,
skipIfNoKaldi
,
skipIfNoSox
,
skipIfNoSoxBackend
,
)
from
.wav_utils
import
(
get_wav_data
,
...
...
test/torchaudio_unittest/common_utils/case_utils.py
View file @
512c2fa4
...
...
@@ -7,7 +7,6 @@ import unittest
import
torch
from
torch.testing._internal.common_utils
import
TestCase
as
PytorchTestCase
import
torchaudio
from
torchaudio._internal.module_utils
import
(
is_module_available
,
is_sox_available
,
...
...
@@ -96,8 +95,6 @@ def skipIfNoModule(module, display_name=None):
return
unittest
.
skipIf
(
not
is_module_available
(
module
),
f
'"
{
display_name
}
" is not available'
)
skipIfNoSoxBackend
=
unittest
.
skipIf
(
'sox'
not
in
torchaudio
.
list_audio_backends
(),
'Sox backend not available'
)
skipIfNoCuda
=
unittest
.
skipIf
(
not
torch
.
cuda
.
is_available
(),
reason
=
'CUDA not available'
)
skipIfNoSox
=
unittest
.
skipIf
(
not
is_sox_available
(),
reason
=
'Sox not available'
)
skipIfNoKaldi
=
unittest
.
skipIf
(
not
is_kaldi_available
(),
reason
=
'Kaldi not available'
)
test/torchaudio_unittest/compliance_kaldi_test.py
View file @
512c2fa4
...
...
@@ -47,7 +47,6 @@ def extract_window(window, wave, f, frame_length, frame_shift, snip_edges):
@
common_utils
.
skipIfNoSox
class
Test_Kaldi
(
common_utils
.
TempDirMixin
,
common_utils
.
TorchaudioTestCase
):
backend
=
'sox_io'
kaldi_output_dir
=
common_utils
.
get_asset_path
(
'kaldi'
)
test_filepath
=
common_utils
.
get_asset_path
(
'kaldi_file.wav'
)
...
...
@@ -113,7 +112,7 @@ class Test_Kaldi(common_utils.TempDirMixin, common_utils.TorchaudioTestCase):
# clear the last 16 bits because they aren't used anyways
y
=
((
y
>>
16
)
<<
16
).
float
()
torchaudio
.
save
(
self
.
test_filepath
,
y
,
sr
)
sound
,
sample_rate
=
torchaudio
.
load
(
self
.
test_filepath
,
normaliz
ation
=
False
)
sound
,
sample_rate
=
common_utils
.
load
_wav
(
self
.
test_filepath
,
normaliz
e
=
False
)
print
(
y
>>
16
)
self
.
assertTrue
(
sample_rate
==
sr
)
self
.
assertEqual
(
y
,
sound
)
...
...
test/torchaudio_unittest/functional/sox_compatibility_test.py
View file @
512c2fa4
...
...
@@ -2,7 +2,7 @@ import torch
import
torchaudio.functional
as
F
from
torchaudio_unittest.common_utils
import
(
skipIfNoSox
Backend
,
skipIfNoSox
,
skipIfNoExec
,
TempDirMixin
,
TorchaudioTestCase
,
...
...
@@ -14,7 +14,7 @@ from torchaudio_unittest.common_utils import (
)
@
skipIfNoSox
Backend
@
skipIfNoSox
@
skipIfNoExec
(
'sox'
)
class
TestFunctionalFiltering
(
TempDirMixin
,
TorchaudioTestCase
):
def
run_sox_effect
(
self
,
input_file
,
effect
):
...
...
test/torchaudio_unittest/transforms/sox_compatibility_test.py
View file @
512c2fa4
...
...
@@ -2,17 +2,19 @@ import torchaudio.transforms as T
from
parameterized
import
parameterized
from
torchaudio_unittest.common_utils
import
(
skipIfNoSox
Backend
,
skipIfNoSox
,
skipIfNoExec
,
TempDirMixin
,
TorchaudioTestCase
,
get_asset_path
,
sox_utils
,
load_wav
,
save_wav
,
get_whitenoise
,
)
@
skipIfNoSox
Backend
@
skipIfNoSox
@
skipIfNoExec
(
'sox'
)
class
TestFunctionalFiltering
(
TempDirMixin
,
TorchaudioTestCase
):
def
run_sox_effect
(
self
,
input_file
,
effect
):
...
...
@@ -24,6 +26,14 @@ class TestFunctionalFiltering(TempDirMixin, TorchaudioTestCase):
expected
,
_
=
self
.
run_sox_effect
(
input_path
,
effects
)
self
.
assertEqual
(
result
,
expected
,
atol
=
atol
,
rtol
=
rtol
)
def
get_whitenoise
(
self
,
sample_rate
=
8000
):
noise
=
get_whitenoise
(
sample_rate
=
sample_rate
,
duration
=
3
,
scale_factor
=
0.9
,
)
path
=
self
.
get_temp_path
(
"whitenoise.wav"
)
save_wav
(
path
,
noise
,
sample_rate
)
return
noise
,
path
@
parameterized
.
expand
([
(
'q'
,
'quarter_sine'
),
(
'h'
,
'half_sine'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment