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
ab733e7b
Unverified
Commit
ab733e7b
authored
Jun 16, 2020
by
jimchen90
Committed by
GitHub
Jun 16, 2020
Browse files
update wav2letter test (#722)
Co-authored-by:
Ji Chen
<
jimchen90@devfair0160.h2.fair
>
parent
e9f19c35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
test/test_models.py
test/test_models.py
+15
-14
No files found.
test/test_models.py
View file @
ab733e7b
import
pytest
import
torch
from
torchaudio.models
import
Wav2Letter
class
TestWav2Letter
:
@
pytest
.
mark
.
parametrize
(
'batch_size'
,
[
2
])
@
pytest
.
mark
.
parametrize
(
'num_features'
,
[
1
])
@
pytest
.
mark
.
parametrize
(
'num_classes'
,
[
40
])
@
pytest
.
mark
.
parametrize
(
'input_length'
,
[
320
])
def
test_waveform
(
self
,
batch_size
,
num_features
,
num_classes
,
input_length
):
model
=
Wav2Letter
()
def
test_waveform
(
self
):
batch_size
=
2
num_features
=
1
num_classes
=
40
input_length
=
320
model
=
Wav2Letter
(
num_classes
=
num_classes
,
num_features
=
num_features
)
x
=
torch
.
rand
(
batch_size
,
num_features
,
input_length
)
out
=
model
(
x
)
assert
out
.
size
()
==
(
batch_size
,
num_classes
,
2
)
@
pytest
.
mark
.
parametrize
(
'batch_size'
,
[
2
])
@
pytest
.
mark
.
parametrize
(
'num_features'
,
[
13
])
@
pytest
.
mark
.
parametrize
(
'num_classes'
,
[
40
])
@
pytest
.
mark
.
parametrize
(
'input_length'
,
[
2
])
def
test_mfcc
(
self
,
batch_size
,
num_features
,
num_classes
,
input_length
):
model
=
Wav2Letter
(
input_type
=
"mfcc"
,
num_features
=
13
)
def
test_mfcc
(
self
):
batch_size
=
2
num_features
=
13
num_classes
=
40
input_length
=
2
model
=
Wav2Letter
(
num_classes
=
num_classes
,
input_type
=
"mfcc"
,
num_features
=
num_features
)
x
=
torch
.
rand
(
batch_size
,
num_features
,
input_length
)
out
=
model
(
x
)
...
...
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