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
hehl2
Torchaudio
Commits
f37d37d6
"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "c88647104d1621b5021d6e3ca18fb8a1f5cdd394"
Unverified
Commit
f37d37d6
authored
Apr 06, 2020
by
moto
Committed by
GitHub
Apr 06, 2020
Browse files
Fix GPU test skip logic (#516)
parent
5f5df1d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
test/test_functional_filtering.py
test/test_functional_filtering.py
+8
-14
No files found.
test/test_functional_filtering.py
View file @
f37d37d6
...
...
@@ -33,12 +33,9 @@ class TestFunctionalFiltering(unittest.TestCase):
def
test_lfilter_basic_double
(
self
):
self
.
_test_lfilter_basic
(
torch
.
float64
,
torch
.
device
(
"cpu"
))
@
unittest
.
skipIf
(
not
torch
.
cuda
.
is_available
(),
"CUDA not available"
)
def
test_lfilter_basic_gpu
(
self
):
if
torch
.
cuda
.
is_available
():
self
.
_test_lfilter_basic
(
torch
.
float32
,
torch
.
device
(
"cuda:0"
))
else
:
print
(
"skipping GPU test for lfilter_basic because device not available"
)
pass
self
.
_test_lfilter_basic
(
torch
.
float32
,
torch
.
device
(
"cuda:0"
))
def
_test_lfilter
(
self
,
waveform
,
device
):
"""
...
...
@@ -87,16 +84,13 @@ class TestFunctionalFiltering(unittest.TestCase):
self
.
_test_lfilter
(
waveform
,
torch
.
device
(
"cpu"
))
@
unittest
.
skipIf
(
not
torch
.
cuda
.
is_available
(),
"CUDA not available"
)
def
test_lfilter_gpu
(
self
):
if
torch
.
cuda
.
is_available
():
filepath
=
os
.
path
.
join
(
self
.
test_dirpath
,
"assets"
,
"whitenoise.wav"
)
waveform
,
_
=
torchaudio
.
load
(
filepath
,
normalization
=
True
)
cuda0
=
torch
.
device
(
"cuda:0"
)
cuda_waveform
=
waveform
.
cuda
(
device
=
cuda0
)
self
.
_test_lfilter
(
cuda_waveform
,
cuda0
)
else
:
print
(
"skipping GPU test for lfilter because device not available"
)
pass
filepath
=
os
.
path
.
join
(
self
.
test_dirpath
,
"assets"
,
"whitenoise.wav"
)
waveform
,
_
=
torchaudio
.
load
(
filepath
,
normalization
=
True
)
cuda0
=
torch
.
device
(
"cuda:0"
)
cuda_waveform
=
waveform
.
cuda
(
device
=
cuda0
)
self
.
_test_lfilter
(
cuda_waveform
,
cuda0
)
@
unittest
.
skipIf
(
"sox"
not
in
BACKENDS
,
"sox not available"
)
@
AudioBackendScope
(
"sox"
)
...
...
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