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
fc2537e7
Unverified
Commit
fc2537e7
authored
Apr 17, 2020
by
moto
Committed by
GitHub
Apr 17, 2020
Browse files
Make batch test backend-agnostic (#561)
parent
84c494dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
4 deletions
+1
-4
test/test_batch_consistency.py
test/test_batch_consistency.py
+1
-4
No files found.
test/test_batch_consistency.py
View file @
fc2537e7
...
@@ -6,7 +6,6 @@ import torchaudio
...
@@ -6,7 +6,6 @@ import torchaudio
import
torchaudio.functional
as
F
import
torchaudio.functional
as
F
import
common_utils
import
common_utils
from
common_utils
import
AudioBackendScope
,
BACKENDS
def
_test_batch_consistency
(
functional
,
tensor
,
*
args
,
batch_size
=
1
,
atol
=
1e-8
,
rtol
=
1e-5
,
**
kwargs
):
def
_test_batch_consistency
(
functional
,
tensor
,
*
args
,
batch_size
=
1
,
atol
=
1e-8
,
rtol
=
1e-5
,
**
kwargs
):
...
@@ -182,10 +181,8 @@ class TestTransforms(unittest.TestCase):
...
@@ -182,10 +181,8 @@ class TestTransforms(unittest.TestCase):
computed
=
torchaudio
.
transforms
.
MelSpectrogram
()(
waveform
.
repeat
(
3
,
1
,
1
))
computed
=
torchaudio
.
transforms
.
MelSpectrogram
()(
waveform
.
repeat
(
3
,
1
,
1
))
torch
.
testing
.
assert_allclose
(
computed
,
expected
)
torch
.
testing
.
assert_allclose
(
computed
,
expected
)
@
unittest
.
skipIf
(
"sox"
not
in
BACKENDS
,
"sox not available"
)
@
AudioBackendScope
(
"sox"
)
def
test_batch_mfcc
(
self
):
def
test_batch_mfcc
(
self
):
test_filepath
=
common_utils
.
get_asset_path
(
'steam-train-whistle-daniel_simon.
mp3
'
)
test_filepath
=
common_utils
.
get_asset_path
(
'steam-train-whistle-daniel_simon.
wav
'
)
waveform
,
_
=
torchaudio
.
load
(
test_filepath
)
waveform
,
_
=
torchaudio
.
load
(
test_filepath
)
# Single then transform then batch
# Single then transform then batch
...
...
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