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
ada50e4e
Unverified
Commit
ada50e4e
authored
Apr 23, 2021
by
Krishna Kalyan
Committed by
GitHub
Apr 23, 2021
Browse files
Add autograd test for T.MelScale (#1467)
parent
faf55235
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
test/torchaudio_unittest/transforms/autograd_test_impl.py
test/torchaudio_unittest/transforms/autograd_test_impl.py
+10
-0
No files found.
test/torchaudio_unittest/transforms/autograd_test_impl.py
View file @
ada50e4e
...
...
@@ -137,6 +137,16 @@ class AutogradTestMixin(TestBaseMixin):
waveform
=
get_whitenoise
(
sample_rate
=
sample_rate
,
duration
=
0.05
,
n_channels
=
2
)
self
.
assert_grad
(
transform
,
[
waveform
])
def
test_melscale
(
self
):
sample_rate
=
8000
n_fft
=
400
n_mels
=
n_fft
//
2
+
1
transform
=
T
.
MelScale
(
sample_rate
=
sample_rate
,
n_mels
=
n_mels
)
spec
=
get_spectrogram
(
get_whitenoise
(
sample_rate
=
sample_rate
,
duration
=
0.05
,
n_channels
=
2
),
n_fft
=
n_fft
,
power
=
1
)
self
.
assert_grad
(
transform
,
[
spec
])
@
parameterized
.
expand
([(
1.5
,
"amplitude"
),
(
2
,
"power"
),
(
10
,
"db"
)])
def
test_vol
(
self
,
gain
,
gain_type
):
sample_rate
=
8000
...
...
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