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
b540e5d1
Unverified
Commit
b540e5d1
authored
May 03, 2021
by
Pavithran Ramachandran
Committed by
GitHub
May 03, 2021
Browse files
Add autograd test for T.SlidingWindowCmn (#1482)
parent
0c263a93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
test/torchaudio_unittest/transforms/autograd_test_impl.py
test/torchaudio_unittest/transforms/autograd_test_impl.py
+17
-0
No files found.
test/torchaudio_unittest/transforms/autograd_test_impl.py
View file @
b540e5d1
...
@@ -154,6 +154,23 @@ class AutogradTestMixin(TestBaseMixin):
...
@@ -154,6 +154,23 @@ class AutogradTestMixin(TestBaseMixin):
waveform
=
get_whitenoise
(
sample_rate
=
sample_rate
,
duration
=
0.05
,
n_channels
=
2
)
waveform
=
get_whitenoise
(
sample_rate
=
sample_rate
,
duration
=
0.05
,
n_channels
=
2
)
self
.
assert_grad
(
transform
,
[
waveform
])
self
.
assert_grad
(
transform
,
[
waveform
])
@
parameterized
.
expand
([
({
'cmn_window'
:
100
,
'min_cmn_window'
:
50
,
'center'
:
False
,
'norm_vars'
:
False
},
),
({
'cmn_window'
:
100
,
'min_cmn_window'
:
50
,
'center'
:
True
,
'norm_vars'
:
False
},
),
({
'cmn_window'
:
100
,
'min_cmn_window'
:
50
,
'center'
:
False
,
'norm_vars'
:
True
},
),
({
'cmn_window'
:
100
,
'min_cmn_window'
:
50
,
'center'
:
True
,
'norm_vars'
:
True
},
),
])
def
test_sliding_window_cmn
(
self
,
kwargs
):
n_fft
=
10
power
=
1
spec
=
get_spectrogram
(
get_whitenoise
(
sample_rate
=
200
,
duration
=
0.05
,
n_channels
=
2
),
n_fft
=
n_fft
,
power
=
power
)
spec_reshaped
=
spec
.
transpose
(
-
1
,
-
2
)
transform
=
T
.
SlidingWindowCmn
(
**
kwargs
)
self
.
assert_grad
(
transform
,
[
spec_reshaped
])
@
unittest
.
expectedFailure
@
unittest
.
expectedFailure
def
test_timestretch_zeros_fail
(
self
):
def
test_timestretch_zeros_fail
(
self
):
"""Test that ``T.TimeStretch`` fails gradcheck at 0
"""Test that ``T.TimeStretch`` fails gradcheck at 0
...
...
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